29.2.3 Preparing Django Settings

When we deploy to production, there are several changes we must always remember to make. The two largest are: keep the SECRET_KEY in the project setting secret and set DEBUG to False.

The problem with changing these settings is that it makes it harder to actually develop the website, where you want DEBUG to be True and you simply want the development server to run, never mind the security key.

To handle both development, production, and any other possible environment, developers split the settings.py file into multiple files. We thus delete suorganizer/settings.py and create the suorganizer/settings/ directory with multiple files. The dev.py file contains all of the settings specific to development, while the ...

Get Django Unleashed 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.