Nikola Skoric <nick-n...@net4u.hr> 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 > 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?
Well settings.py is a normal python program so you can put any mechanisms you can think of in there. For example (from simple to complex) Make settings.py a symlink to the correct one for the machine. Make a subsettings.py which is a symlink to the correct one for the machine. Pass in some of the settings in the environment and read them with os.environ. 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 <n...@craig-wood.com> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list