Creating a Django Boilerplate!(part 2)

Shrey Modi
2 min readOct 2, 2020

--

Part 2(Setting up multiple settings modules)

So mainly in this part we will focus on making different settings module like development and production.

Make a folder named settings and add a file called __init__.py in it.Then move the settings.py in the folder and rename it as base.py.

Make two new files named development.py and production.py.

In development file we will include the settings required for the development like the app or function name in INSTALLED_APPS, added functions in MIDDLEWARE , DATABASE and the entire debug toolbar setting.

while the production file will include AUTH_PASSWORD_VALIDATORS, DATABASES(sqllite or postgres or any other) and the stripe keys if payment is integrated in it. After adding all these just delete the the added items from the main file i.e base.py

so now the runserver command would get confuse which setting to take so for that we need to make some change in the manage.py file in the line 8 as below:

And also change the BASE_DIR settings as follow:

The folder structure will be as following:

folder structure

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Shrey Modi
Shrey Modi

No responses yet

Write a response