There are a couple possible options without going outside the INI-confines of PasteDeploy. However, up front, realize the beauty of the INI file model is an underlying ability to create multiple files with different settings/configurations. Yes, you have to keep them in sync, but they are just settings (no logic) so that shouldn't be insurmountable.
Anyway, PasteDeploy supports a default section that is inherited by the [app:XXX]
sections. So you can place common settings there, and have a different [app:myapp-dev]
and [app:myapp-prod]
sections.
# settings.ini
[DEFAULT]
foo = bar
[app:myapp-dev]
use = egg:myapp
[app:myapp-prod]
use = egg:myapp
set foo = baz
This can be run via
env/bin/pserve -n myapp-dev settings.ini
Another option is to use multiple configuration files.
# myapp.ini
[app:myapp-section]
use = egg:myapp
foo = bar
# myapp-dev.ini
[app:main]
use = config:myapp.ini#myapp-section
foo = baz
# myapp-prod.ini
[app:main]
use = config:myapp.ini#myapp-section
This can be run via
env/bin/pserve myapp-prod.ini
If you don't want to use PasteDeploy (ini files), you can do something in Python but there are real benefits to this configuration being simple.