, ( digitalocean.com), , , 502.
, IP-.
virtualenv ( "manage.py" ) gunicorn.py: (: 3.4)
"""
Run Gunicorn (Django) on a specific IP addr
"""
import os
os.chdir("/home/your_path/name_of_env/")
os.system("bin/gunicorn -w 3 -b 127.0.0.1:8000 your_project.wsgi:application &")
script Gunicorn, virtualenv ( "bin/gunicorn" ) ( "&" ).
. virtualenv, "bin/" script .
script , .profile . ( )
python3.4 path/to/the/file/gunicorn.py
nginx :
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarder-For $proxy_add_x_forwarded_for;
}
, IP- 127.0.0.1:8000 . , Django, 2 :
- Gunicorn "ps aux | grep gunicorn" "kill -9 [PID]", , , "python3.4 manage.py runningerver"
- Django, IP- , "python3.4 manage.py runningerver 0.0.0.0:8001"
.