wgx731's Technical Blog

Programmer @ National University Of Singapore.

Django local_settings.py

| Comments

During my internship at Tripvillas plus the experience on HackDo project, I have noticed that it’s important to have a good local_settings.py file to differentiate the production and development environment as well as hiding the confidential information for Django application.

My approach is to have a _local_settings.py in your code base and write instructions on how you should modify the _local_settings.py to become your development local_settings.py, here is one example I used for HackDo:

There are other approaches like make settings a module and create production.py, development.py and so on, and then put all the confidential information in environment variables.

At last, I just want to comment that don’t ever put confidential information in the code base.

Comments