Altering settings at runtime

You shouldn't alter settings in your applications at runtime. For example, don't do this in a view:

from django.conf import settings
settings.DEBUG = True   # Don't do this! 

The only place you should assign to settings is in a settings file.

Get Mastering Django: Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.