[Fixed]-Start Django with different setting values

1๐Ÿ‘

โœ…

You can choose which settings.py file to use with DJANGO_SETTINGS_MODULE; you can have many that import * from a main one, and then change what needs to be changed.

Alternatively, settings.py is just a Python file. You can get values of settings from environment variables, if you want:

import os

ALLOW_ROBOTS = bool(os.getenv('ALLOW_ROBOTS', False))

And then change that environment variable from Travis.

๐Ÿ‘คRemcoGerlich

0๐Ÿ‘

If I understand your question correctly, you would like to be able to use multiple settings modules. If so, setting the DJANGO_SETTINGS_MODULE environment variable before starting the server is likely what you need.

๐Ÿ‘คzsepi

Leave a comment