Menu Close

How to manage local vs production settings in Python Django?

Sometimes, we want to manage local vs production settings in Python Django.

In this article, we’ll look at how to manage local vs production settings in Python Django.

How to manage local vs production settings in Python Django?

To manage local vs production settings in Python Django, we can use the --settings flag to specify the settings file to use.

We create a settings file for each environment.

And then we can run our Django app with the settings for the given environment with

python3 manage.py runserver --settings=settings_you_wish_to_use.py

to run runserver with

--settings=settings_you_wish_to_use.py

to run our app with the settings in settings_you_wish_to_use.py.

Conclusio

To manage local vs production settings in Python Django, we can use the --settings flag to specify the settings file to use.

Posted in Python, Python Answers