including constants

Andreas Waldenburger usenot at geekmail.INVALID
Sun Sep 13 15:30:00 EDT 2009


On Sun, 13 Sep 2009 18:44:25 +0000 (UTC) Nikola Skoric
<nick-news at net4u.hr> wrote:

> Hi there,
> 
> 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
> settings.py 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?
> 
> Thanks in advance.
> 

The basic principle seems alright, but since you're talking about
configuration, you could use the ConfigParser module from the stdlib to
create real configuration files. That's what I would do for any
reasonably sized project.

/W

-- 
INVALID? DE!




More information about the Python-list mailing list