Answer the question
In order to leave comments, you need to log in
How to properly configure NGINX and Gunicorn for Django?
I deploy a django application to the server using Gunicorn according to the digitalocean instructions:
https://www.digitalocean.com/community/tutorials/h...
The application responds completely, but files from static are not loaded. What have I done wrong? Tried already a bunch of options
nginx configs
server {
server_name test.sportcourts.ru;
access_log off;
location /static/ {
root /opt/myenv/sportcourts/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM N$
}
}
ALLOWED_HOSTS = ['test.sportcourts.ru', '127.0.0.1:8001']
DEBUG = True
STATIC_URL = '/static/'
STATIC_ROOT = '/opt/myenv/sportcourts/static/'
command = '/opt/myenv/bin/gunicorn'
pythonpath = '/opt/myenv/sportcourts'
bind = '127.0.0.1:8001'
workers = 3
/opt/myenv/bin/gunicorn -c /opt/myenv/gunicorn_config.py sportcourts.wsgi
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question