EC2, NGINX, GUnicorn Django Blog fails to base load CSS


First timer here… and it seems to be a common issue? I’ve been slogging through this for the last 3 days, and just can’t get static to load using nginx on EC2.

Here is my setup. static:

STATIC_ROOT = '/var/www/too_hard/static'
STATIC_URL = '/static/'

path to static using pwd:


nginx conf file:

include /etc/nginx/mime.types;


        listen 80;

        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
                autoindex on;
                alias /var/www/too_hard/static/;

        location / {

                include proxy_params;
                proxy_pass http://unix:/home/ubuntu/too_hard/too_hard/app.sock;



I have already run collectstatic into the var/www/too_hard/static folder.

It seems the CSS from Django’s default View classes are working, but any other css like the nav bar is not. Please advise.

First, verify that the files and directories in /var/www/too_hard/static/ are readable by the nginx process (usually uid/gid “www-data”)

Then, check your nginx error log for the error messages associated with the reference to those files.

Check for the existance of all the static files within that directory tree.

1 Like

Hi Ken,

Thanks for the tip on the error_log. Turns out my problem wasn’t any config/permissions issue…

it was a missing main.css file… which was in a static folder the main app (instead of in the base static folder).

resolved by adding that directly to the STATICFILES_DIR.

happy holidays :slight_smile: