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

  • SEARCH
  • Home
  • 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 4320516
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:38:34+00:00 2026-05-21T08:38:34+00:00

I was wondering if it was possible to separate the local configuration in Django

  • 0

I was wondering if it was possible to separate the “local” configuration in Django (Local path to static, templates content which have to be absolute, local DB info, etc…) from the “global” configuration (URL, Middleware classes, installed apps, etc…) so that several people can work on a same project over Git or SVN without having to rewrite the local settings every time there is a commit done!

Thanks!

  • 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-05-21T08:38:35+00:00Added an answer on May 21, 2026 at 8:38 am

    Yes, definitely. The settings.py file is just Python, so you can do anything in there – including setting things dynamically, and importing other files to override.

    So there’s two approaches here. The first is not to hard-code any paths, but calculate them dynamically.

    PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
    TEMPLATE_DIRS = [
        os.path.join(PROJECT_ROOT, "templates"),
    ]
    

    etc. The magic Python keyword __file__ gives the path to the current file.

    The second is to have a local_settings.py file outside of SVN, which is imported at the end of the main settings.py and overrides any settings there:

    try:
        from local_settings import *
    except ImportError:
        pass
    

    The try/except is to ensure that it still works even if local_settings is not present.

    Naturally, you could try a combination of those approaches.

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

Sidebar

Related Questions

I am wondering if its possible to have a an (||)or or (&&)and operator
Is it possible to have two separate preferences in an app ? I have
I am wondering if it is possible to have a JSF handler and some
I am wondering it is possible to have multiple GridFS in Mongo? The reason
I am wondering if it is possible to alias 2 columns from 2 separate
I was wondering if the following migration is possible with Django south and still
I'm writing a library for C#. I'm wondering if it's possible to only have
I was wondering if it is possible to execute a coded UI test which
Was wondering if the following is possible: Currently, I have a subset of nodes
I was wondering if its possible to have jQuery Tabs that follows a parent

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.