Skip to content

Instantly share code, notes, and snippets.

Created Apr 13, 2015
What would you like to do?
Lifehack! Nginx proxy django static files with DEBUG=True.
location /static {
root /path/to/project/;
try_files $uri @django;
Copy link

phpdude commented Apr 13, 2015

Sometimes you need to proxy your django dev server with nginx without disabling DEBUG.

You can collectstatic everytime you change it, but not me :-)

This configuration tries collected static files folder first and fetch it via your django dev server if nothing found in collected.

ps: @django is your named nginx location for proxing django requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment