문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top