0

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/

sohretaga
  • 69
  • 1
  • 9

1 Answers1

0

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/'),)
Mayank Gupta
  • 41
  • 1
  • 2