python - Organizing pyramid / paster config files in a modular way -
i have pyramid application using paster ini file, hosted via uwsgi. want host different instances (i.e. development, staging, production), ideally without having touch config file @ all. different instances need different settings. approach like:
[app:base] sqlalchemy.url = some/connection/string/%(instance)s [app:development] instance = development [app:production] instance = production
that not work, because instance
not yet defined, when sqlalchemy.url
defined. tried inject instance
somehow outside, without success. i'm not able access environment variables. tried pass values via uwsgi_param
nginx, not work.
how organize paster ini files in modular way, not have duplicate settings?
you can use "config:" url include settings file.
in "shared.ini"
[app:myapp] use = egg:myapp
in "development.ini"
[app:main] use = config:shared.ini#myapp = 2
in "production.ini"
[app:main] use = config:shared.ini#myapp = 3
here's real world code uses pattern:
https://github.com/pylons/sdidev/blob/master/etc/development.ini
Comments
Post a Comment