including constants

N

Nikola Skoric

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.
 
A

Andreas Waldenburger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top