Question

Is a setup like this not possible?

production.ini file:

[app:main]
use = egg:my_project

 ... various settings ...

[server:main]
...

development.ini file:

[app:main]
use = config:production.ini#main

... override some production settings ...

Then I try starting my development server and get:

No section 'main' (prefixed by 'server') found in config development.ini

I'd like to chain my config files together like so:

production.ini -> development.ini -> local.ini -> test.ini

It seems like this should be possible, but I haven't gotten the magic right yet.

Was it helpful?

Solution

It is possible to inherit INI files, but the inheritance only works on a section-by-section basis. So if you don't explicitly tell "test.ini" to inherit the [server:main] section, then it won't. The docs on all of this are via the PasteDeploy package although it's not entirely obvious.

I've never actually seen an inheritance chain for the [server] section, but it may be possible... usually you just see that done with [app] sections. I wouldn't be surprised if you had to duplicate that section between files.

As a side note, the logging configuration in an INI file is not inheritable... that's not actually controlled by PasteDeploy at all so you'd have to duplicate it in each file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top