Django Development Server with DEBUG=False

When you run the Django development server with DEBUG=True, static files are served from their location before collectstatic is run. This is what you want because changes you make are immediately reflected in your pages. Also all hosts are allowed.

Of course you would never run in production with DEBUG=True. This means your development system is not a very good replica of the production system when it comes to static files. If you are having problems with static files, it would be nice if you could work on them in development. It turns out you can. Just run:

python runserver --insecure

You also will need to setup a local directory for collectstatic to write to:

MEDIA_ROOT = 'my local media root'
STATIC_ROOT = 'my local static root'

then run collectstatic. In my case, I also needed to turn off django-pipeline.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s