'Nginx not calling static files on site
Django works fine but static files are not called
server {
listen 80;
server_name www.bakuklinik.shop bakuklinik.shop;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
autoindex on;
alias /root/myprojectdir/;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
settings.py
STATIC_URL = 'static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
I'm using Ubuntu 20.04 on DigitalOcean
You can view the site here: http://bakuklinik.shop/
Solution 1:[1]
This works for me. And please don't forget to restart your server.
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
STATICFILES_DIRS = (os.path.join(SITE_ROOT, 'static/'),)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mayank Gupta |
