# HG changeset patch # User Daniele Nicolodi # Date 1321467028 -3600 # Node ID fd572809cb18ccaffb3a48dbd315ab7603ebeee6 # Parent d6b205e8c1f9162cc6e6cafd9f70e815390e140e Add local configuration file as arguments to user scripts. * * * Example configuration file. diff -r d6b205e8c1f9 -r fd572809cb18 buildout.cfg --- a/buildout.cfg Wed Nov 16 19:10:22 2011 +0100 +++ b/buildout.cfg Wed Nov 16 19:10:28 2011 +0100 @@ -1,9 +1,10 @@ [buildout] include-site-packages = false -parts = flask wsgi +parts = install instance wsgi develop = src -[flask] +# install software +[install] recipe = zc.recipe.egg eggs = distribute @@ -15,14 +16,22 @@ python-dateutil < 2.0 ltpdarepo interpreter = python +scripts = + +# generate scripts pointing to the right configuration file +[instance] +recipe = zc.recipe.egg:script +eggs = ${install:eggs} scripts = run admin +arguments = '${buildout:directory}/etc/ltpdarepo' +# generate wsgi application [wsgi] recipe = zc.recipe.egg:script -eggs = ${flask:eggs} +eggs = ${install:eggs} scripts = wsgi entry-points = wsgi=ltpdarepo:main initialization = from ltpdarepo import Application - application = Application() + application = Application('${buildout:directory}/etc/ltpdarepo') diff -r d6b205e8c1f9 -r fd572809cb18 develop.cfg --- a/develop.cfg Wed Nov 16 19:10:22 2011 +0100 +++ b/develop.cfg Wed Nov 16 19:10:28 2011 +0100 @@ -2,15 +2,18 @@ extends = buildout.cfg parts += omelette -[flask] -eggs += - unittest2 - coverage - zope.testbrowser [wsgi] - SQLAlchemy -scripts += unit2 coverage +# install development dependencies +[install] +recipe = zc.recipe.egg +eggs += + unittest2 + coverage + zope.testbrowser [wsgi] + SQLAlchemy +scripts = unit2 coverage +# generate a flattened view of the installed eggs [omelette] recipe = collective.recipe.omelette -eggs = ${flask:eggs} +eggs = ${install:eggs} ignore-develop = true diff -r d6b205e8c1f9 -r fd572809cb18 etc/ltpdarepo.ex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/ltpdarepo.ex Wed Nov 16 19:10:28 2011 +0100 @@ -0,0 +1,23 @@ +# secret key used for session cookie encryption +SECRET_KEY = 'please change this!' + +# database connection parameters +HOSTNAME = 'localhost' +USERNAME = 'root' +PASSWORD = '' +DATABASE = 'ltpda' + +# mailserver +MAIL_SMTP_SERVER = 'localhost' +MAIL_SMTP_PORT = 25 +MAIL_SMTP_USETLS = False +MAIL_SMTP_USERNAME = '' +MAIL_SMTP_PASSWORD = '' + +# administrator email +ADMIN_EMAIL_ADDR = '' + +# debuggig +DEBUG = False +# suppress outgoing emails +TESTING = True diff -r d6b205e8c1f9 -r fd572809cb18 src/ltpdarepo/__init__.py --- a/src/ltpdarepo/__init__.py Wed Nov 16 19:10:22 2011 +0100 +++ b/src/ltpdarepo/__init__.py Wed Nov 16 19:10:28 2011 +0100 @@ -197,6 +197,6 @@ self.register_blueprint(users, url_prefix='/manage/users') -def main(): - app = Application() +def main(conf=None): + app = Application(conf) app.run()