Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7980351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:02:53+00:00 2026-06-04T10:02:53+00:00

I have been developing a basic app. Now at the deployment stage it has

  • 0

I have been developing a basic app. Now at the deployment stage it has become clear I have need for both a local settings and production settings.

It would be great to know the following:

  • How best to deal with development and production settings.
  • How to keep apps such as django-debug-toolbar only in a development environment.
  • Any other tips and best practices for development and deployment settings.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:02:54+00:00Added an answer on June 4, 2026 at 10:02 am

    The DJANGO_SETTINGS_MODULE environment variable controls which settings file Django will load.

    You therefore create separate configuration files for your respective environments (note that they can of course both import * from a separate, “shared settings” file), and use DJANGO_SETTINGS_MODULE to control which one to use.

    Here’s how:

    As noted in the Django documentation:

    The value of DJANGO_SETTINGS_MODULE should be in Python path syntax, e.g. mysite.settings. Note that the settings module should be on the Python import search path.

    So, let’s assume you created myapp/production_settings.py and myapp/test_settings.py in your source repository.

    In that case, you’d respectively set DJANGO_SETTINGS_MODULE=myapp.production_settings to use the former and DJANGO_SETTINGS_MODULE=myapp.test_settings to use the latter.


    From here on out, the problem boils down to setting the DJANGO_SETTINGS_MODULE environment variable.

    Setting DJANGO_SETTINGS_MODULE using a script or a shell

    You can then use a bootstrap script or a process manager to load the correct settings (by setting the environment), or just run it from your shell before starting Django: export DJANGO_SETTINGS_MODULE=myapp.production_settings.

    Note that you can run this export at any time from a shell — it does not need to live in your .bashrc or anything.

    Setting DJANGO_SETTINGS_MODULE using a Process Manager

    If you’re not fond of writing a bootstrap script that sets the environment (and there are very good reasons to feel that way!), I would recommend using a process manager:

    • Supervisor lets you pass environment variables to managed processes using a program’s environment configuration key.
    • Honcho (a pure-Python equivalent of Ruby’s Foreman) lets you define environment variables in an “environment” (.env) file.

    Finally, note that you can take advantage of the PYTHONPATH variable to store the settings in a completely different location (e.g. on a production server, storing them in /etc/). This allows for separating configuration from application files. You may or may not want that, it depends on how your app is structured.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been developing an app in FatFree framework and now I am trying
Lately I have been thinking about developing some basic android app. Its only due
I have been developing a game basic card game for Android. At the moment
I have been developing an app in VB.NET which requires a control object (for
I have been developing an asp.net mvc application where i need to make large
I have been developing an Android app and testing with a 1.5 AVD and
I have been developing Android application, and I need to read PDF-files in my
I have been developing for some time now, and I have not used pointers
I have been developing a windows form based project in visual basic .NET, moving
Recently I have been developing an app that needs AES encryption. I am using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.