including constants

Nick Craig-Wood nick at
Mon Sep 14 10:29:55 CEST 2009

Nikola Skoric <nick-news at> wrote:
>  I have a simple problem and I know how to solve it :-D, but I suspect that
>  there is a standard solution which is more elegant.
>  So, here is my problem: I have django app versioned with svn and I
>  test my trunk on two different machines (one with mysql, another with
>  sqlite3). How do I remove database-definition constants from my
> and put them in a separate file which wouldn't be
>  maintained by svn? (did I really hear somebody call that kind of file
>  "unversioned file" or did I make that up?) I suppose I could make a
>  trivial module with database info, import it and then assign my
>  constants with data from that module, but that looks so unelegant to
>  me. What's the standard way of doing this?

Well is a normal python program so you can put any
mechanisms you can think of in there.

For example (from simple to complex)

Make a symlink to the correct one for the machine.

Make a which is a symlink to the correct one for the

Pass in some of the settings in the environment and read them with

Look up the hostname of the machine and import a secondary file of
settings with that name.  This has the advantage that you can check
everything in.

Nick Craig-Wood <nick at> --

More information about the Python-list mailing list