Hello once again Django community,
I am trying to deploy a project into production using nginx and gunicorn. I have created another test project called donuts for lack of a better name to troubleshoot the problem. Still getting the same results with the test project - gunicorn serving the application but nginx not serving static css files. I will include the details below… Any assistance would be appreciated.
PS - static files are displayed correctly with css via runserver but not with nginx/gunicorn
Getting the following nginx /var/log/nginx/error_log …
2024/07/30 21:03:14 [error] 6967#6967: *1 open() "/home/marc/webdev/donuts/static/main/css/main.css" failed (13: Permission denied), client: 192.168.1.1, server: mmbella.org, request: "GET /static/main/css/main.css HTTP/1.1", host: "mmbella.org", referrer: "http://mmbella.org/main/"
Permissions on css file are good for read…
-rw-r--r-- 1 marc marc 52 Jul 30 20:59 /home/marc/webdev/donuts/static/main/css/main.css
Thanks
Marc
SETTINGS
STATIC_DIR = os.path.join(BASE_DIR,"static")
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
NGINX
server {
listen 80;
server_name mmbella.org;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/marc/webdev/donuts;
}
location /media/ {
root /home/marc/webdev/donuts;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}