Creating and including local settings

Configuration doesn't necessarily need to be complex. If you want to keep things simple, you can work with two settings files: settings.py for common configuration and local_settings.py for sensitive settings that shouldn't be under version control.

Getting ready

Most of the settings for different environments will be shared and saved in version control. However, there will be some settings that are specific to the environment of the project instance, for example, database or e-mail settings. We will put them in the local_settings.py file.

How to do it…

To use local settings in your project, perform the following steps:

  1. At the end of settings.py, add a version of local_settings.py that claims to be in the same ...

Get Django: Web Development with Python 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.