Categories
Python Answers

How to manage local vs production settings in Python Django?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *