I am trying to run the django admin app using gunicorn 19.19.0 and nginx 1.10.3 on a raspberry pi 3 (raspian 9) with python 3.5.3 and django 2.1.7. Nginx seems to be working properly and the nginx and gunicorn error logs are empty. The app will not display any static content however.
I checked the nginx.conf file.
I ran collectstatic and checked that all the files are there.
I can point a browser to 192.168.1.20/static and it shows the right directory.
I can also browse to all the files.
I tried following the path in the nginx.conf file with a '/'
All functions of the admin app work fine. just no static content.
I've googled and read/tried every forum fix that i can find.
I have also run the python development server (python manage.py runserver). In that config static content shows just fine.
nginx.conf file
events{}
http {
server {
listen 80;
server_name localhost;
location /static {
autoindex on;
alias /home/pi/DigitalClock/dcvenv/static;
}
location / {
error_log /home/pi/DigitalClock/dcvenv/nginx_err.log;
access_log /home/pi/DigitalClock/dcvenv/nginx_acc.log;
proxy_pass http://127.0.0.1:8000;
}
}
}
gunicorn start command
gunicorn dcweb.wsgi:application --bind localhost:8000
django project settings file
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,'static/')
last entries of ngnix_acc.log (*_err.log is empty)
192.168.1.10 - - [18/Feb/2019:12:45:43 -0800] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0 "http://192.168.1.20/admin/login/?next=/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" 192.168.1.10 - - [18/Feb/2019:12:45:43 -0800] "GET /admin/ HTTP/1.1" 200 4944 "http://192.168.1.20/admin/login/?next=/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" 192.168.1.10 - - [18/Feb/2019:12:45:59 -0800] "GET /admin/auth/group/ HTTP/1.1" 200 3500 "http://192.168.1.20/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" 192.168.1.10 - - [18/Feb/2019:12:45:59 -0800] "GET /admin/jsi18n/ HTTP/1.1" 200 3185 "http://192.168.1.20/admin/auth/group/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
/
for static files as:location /static/ {alias /home/pi/DigitalClock/dcvenv/static/ ;}
, also try removing autoindex on. – Reema Parakh