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 172503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:10:39+00:00 2026-05-11T13:10:39+00:00

One of my favorite features about python is that you can write configuration files

  • 0

One of my favorite features about python is that you can write configuration files in python that are very simple to read and understand. If you put a few boundaries on yourself, you can be pretty confident that non-pythonistas will know exactly what you mean and will be perfectly capable of reconfiguring your program.

My question is, what exactly are those boundaries? My own personal heuristic was

  1. Avoid flow control. No functions, loops, or conditionals. Those wouldn’t be in a text config file and people aren’t expecting to have understand them. In general, it probably shouldn’t matter the order in which your statements execute.
  2. Stick to literal assignments. Methods and functions called on objects are harder to think through. Anything implicit is going to be a mess. If there’s something complicated that has to happen with your parameters, change how they’re interpreted.
  3. Language keywords and error handling are right out.

I guess I ask this because I came across a situation with my Django config file where it seems to be useful to break these rules. I happen to like it, but I feel a little guilty. Basically, my project is deployed through svn checkouts to a couple different servers that won’t all be configured the same (some will share a database, some won’t, for example). So, I throw a hook at the end:

try:     from settings_overrides import *     LOCALIZED = True except ImportError:     LOCALIZED = False 

where settings_overrides is on the python path but outside the working copy. What do you think, either about this example, or about python config boundaries in general?

  • 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. 2026-05-11T13:10:40+00:00Added an answer on May 11, 2026 at 1:10 pm

    There is a Django wiki page, which addresses exactly the thing you’re asking. http://code.djangoproject.com/wiki/SplitSettings

    Do not reinvent the wheel. Use configparser and INI files. Python files are to easy to break by someone, who doesn’t know Python.

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

Sidebar

Ask A Question

Stats

  • Questions 101k
  • Answers 101k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Anything that is abstractable to an extendable root upon which… May 11, 2026 at 8:00 pm
  • Editorial Team
    Editorial Team added an answer You could also make this work in a function. var… May 11, 2026 at 8:00 pm
  • Editorial Team
    Editorial Team added an answer Try the following var col = GetTheCollection(); var subset =… May 11, 2026 at 8:00 pm

Related Questions

I have a project in mind, here's the pitch. When I come to a
How do you feel about VS making you hunt for a tab that you
One of my favorite features in Eclipse is the templates in PDT. In case
One of my favorite vim features is the ability to do set path=/my/project/root/** and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.