[Django]-Django app deployment not loading static files

5👍

Django’s runserver serves static files through python automatically, which is not good enough for production use. When you deploy and are thus not using runserver, your static files are not auto-served.

In production, you must run the python manage.py collectstatic command which moves all static files to your settings.STATIC_ROOT.

You then need to serve settings.STATIC_ROOT at settings.STATIC_URL via your web server of choice, very commonly nginx as a reverse proxy behind your Apache-mod_wsgi app server.

You can also use your Apache, where you’d want to look into the <Directory> directive.

The documentation you linked to explains exactly what you need to do, and hopefully my bullet points make it a little easier to understand.

https://docs.djangoproject.com/en/dev/howto/deployment/wsgi//modwsgi/#serving-files

Leave a comment