Skip to content

Instantly share code, notes, and snippets.

@phpdude phpdude/nginx.conf
Created Apr 13, 2015

Embed
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;
}
@phpdude

This comment has been minimized.

Copy link
Owner Author

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
You can’t perform that action at this time.