I am running a django with nginx as a web server. After configuration its seems that I am always getting 404 for static files. Here is my configurtaion
base.py
STATIC_ROOT = os.path.join(PROJECT_DIR, "static")
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(PROJECT_DIR, 'static_files'),
]
nginx.conf
upstream django {
server unix:///tmp/mysite.sock;
}
# configuration of the server
server {
listen 5000;
server_name server localhost:5000; address or FQDN
charset utf-8;
client_max_body_size 75M;
location /static {
alias /Users/del/projects/app-backend/static/;
}
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
autoindex on;
root /Users/del/projects/app-backend/static/;
}
location / {
uwsgi_pass django;
include /Users/del/perso/django/library/uwsgi;
}
}
I have made sure to run python manage.py collectstatic, and the files are actually generated under /static/ folder