From 4f558774c752f95eca98cdd7a5dd0e95a22a0551 Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Tue, 15 Mar 2011 16:41:30 -0400 Subject: [PATCH] add deploy helper --- pecan/deploy.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 pecan/deploy.py diff --git a/pecan/deploy.py b/pecan/deploy.py new file mode 100644 index 0000000..36218d1 --- /dev/null +++ b/pecan/deploy.py @@ -0,0 +1,14 @@ +from configuration import set_config, import_module, _runtime_conf as conf + +def deploy(config_module_or_path): + set_config(config_module_or_path) + for module in getattr(conf.app, 'modules'): + try: + module_app = import_module('%s.app' % module.__name__) + if hasattr(module_app, 'setup_app'): + return module_app.setup_app(conf) + except ImportError: + continue + + raise Exception, 'No app.setup_app found in any of the configured app.modules' +