How to post Django static files in production

Viewed 1766

I cannot get my Django app to pick up static files in production environment.

Within settings.py I've specified

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static"),
)
STATIC_ROOT = '/var/www/static/'

and I've included django.contrib.staticfiles in INSTALLED_APPS.

I've run manage.py collectstatic and it is moving the static files to the /var/www/static/.

The html resulting shows, for example <link rel="stylesheet" type="text/css" href="/static/myStyleSheet.css"> from a django file which had <link rel="stylesheet" type="text/css" href="{% static 'myStyleSheet.css' %}">.

It seems to me it should work but I'm clearly missing something. I'm getting 404 errors on the static files.

1 Answers
Related