Common problem finding static files. Help appreciated.

24 views
Skip to first unread message

Scott Zimmerman

unread,
Aug 18, 2021, 9:03:00 AM8/18/21
to Django users

 I deployed django + nginx + gunicorn, and DEBUG = True. Nginx/error.log shows that my problem finding static files is a concatenation mistake (caps added)...

    "/home/www/wcsdg/main/STATIC/STATIC/main/styles.css" failed (2: No such file or directory),
 It should instead search for...

    "/home/www/wcsdg/main/static/main/styles.css"

But there are 3 places where "static" is configured and I don't know what I'm doing wrong:

In settings.py...

    STATIC_URL = '/static/'
    STATIC_ROOT = '/home/www/wcsdg/main/static'

In /etc/nginx/sites-available/wcsdg...

    location /static {
        root /home/www/wcsdg/main/static;
    }

I also added whitenoise as an app in settings.py and restarted nginx and gunicorn but it didn't help.

Any advice?

Scott Zimmerman

unread,
Aug 18, 2021, 2:59:58 PM8/18/21
to Django users
Resolved by changing nginx config file from above to this:
location /static {
        root /home/www/wcsdg/main;
    }
Reply all
Reply to author
Forward
0 new messages