Keepin constants, configuration values, etc. in Python - dedicated module or what?

Chris Angelico rosuav at gmail.com
Tue Sep 30 19:49:08 CEST 2014


On Wed, Oct 1, 2014 at 3:30 AM,  <cl at isbd.net> wrote:
> The main trouble with this approach is that I need some way to have
> the python/config file available at the 'home' end of this as well as
> at the 'remote' end.  I guess I could write a copy of the file into
> the database but then I have the editing issue again, changing it
> becomes messy.  If it's not in the database then how do I 'tie' it to
> the data?

That's a design question. Maybe it's better for you to do your config
in the database. I usually find that these config files include
database credentials (server, port, user name, password), so they have
to be (a) outside the database, (b) outside source control, and (c)
separately configurable for test and production systems, even if they
run on the exact same hardware. So for those situations, it makes more
sense to have them in a script or INI file, rather than the database.
Your situation may well be completely different.

ChrisA



More information about the Python-list mailing list