Giter Site home page Giter Site logo

tfserver's Introduction

Installing Server

How to setup a django using nginx+uWSGI - full tutorial with tests on https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html)

  1. If pip is still not available, install using:
    $ sudo apt-get install python-setuptools

  2. Download django:
    $ sudo pip install Django

  3. Install uwsgi:
    $ sudo pip install uwsgi

  4. Stop apache2 and uninstall it [if installed]:
    $ sudo service apache2 stop
    $ sudo apt-get remove apache2

  5. Install nginx:
    $ sudo apt-get install nginx
    $ sudo service nginx start

  6. Move to your project's path:
    cd /path/to/mysite/

  7. Create an uwsgi_params file on your mysite's root:
    $ sudo nano uwsgi_params
    And paste the content from this file: https://github.com/nginx/nginx/blob/master/conf/uwsgi_params

  8. Create a file called mysite_nginx.conf and put this:

```
# mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    #server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      8000;
    # the domain name it will serve for
    server_name .example.com; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    location /media  {
        alias /path/to/your/mysite/mysite/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /path/to/your/mysite/mysite/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /path/to/your/mysite/uwsgi_params; # the uwsgi_params file you installed
    }
}
```
  1. Symlink to this file from /etc/nginx/sites-enabled:
    $ sudo ln -s ~/path/to/your/mysite/mysite_nginx.conf /etc/nginx/sites-enabled/

  2. Run this command (from inside your mysite's folder):
    $ uwsgi --socket mysite.sock --module mysite.wsgi --chmod-socket=666

  3. Restart nginx:
    $ sudo service nginx restart

  • IMPORTANT NOTE: if you're doing this in a remote server (amazon EC2 or whatever), you will notice that once you've done the uwsgi command, you'll have your command line freezed. For this matter, replace step 10 with the screen tool as follows:
    $ screen
    $ uwsgi --socket mysite.sock --module mysite.wsgi --chmod-socket=666
    Press ctrl + d
    You can go back there anytime by typing $ screen -ls and typing $ screen -r [PID_FROM_THE_SCREEN_YOU_WANT]
  1. To run server:
    uwsgi --ini /home/ubuntu/TFServer/tf/mysite_uwsgi.ini

TFServer

  1. UBUNTU SETUP:
  • Install mysql
  • Install git
  1. UBUNTU PYTHON MATH SETUP:
  • apt-get install python-numpy
  • apt-get install python-scipy
  • apt-get install python-pandas
  • apt-get install python-sympy (deprecated)
  • apt-get install python-sklearn
  • apt-get install cython
  • apt-get install python-setuptools
  • sudo easy_install -U scikit-image
  • sudo easy_install boto
  • sudo easy_install PIL
  1. HOW TO FIX REQUIRE_DEBUG_FALSE BUG:
  • Remove any lines (and containers) containing require debug_false from both files:
    • /usr/lib/python2.7/dist-packages/django/conf/global_settings.py
    • [PROJECT_DIR]/tf/tf/settings.py

tfserver's People

Contributors

accordeiro avatar vitchor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.