From: Mike Bayer Date: Tue, 19 Apr 2011 19:16:39 +0000 (-0400) Subject: here's what im doing with pylons at the moment X-Git-Tag: rel_0_1_0~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1789f440552c4f2900a2a8799769a18f4035624;p=thirdparty%2Fsqlalchemy%2Falembic.git here's what im doing with pylons at the moment --- diff --git a/alembic/templates/pylons/env.py b/alembic/templates/pylons/env.py index d7330221..8f868c36 100644 --- a/alembic/templates/pylons/env.py +++ b/alembic/templates/pylons/env.py @@ -6,12 +6,19 @@ be loaded from there. """ from alembic import options, context from paste.deploy import loadapp -from pylons import config import logging -config_file = options.get_main_option('pylons_config_file') -logging.fileConfig(config_file) -wsgi_app = loadapp('config:%s' % config_file, relative_to='.') +try: + # if pylons app already in, don't create a new app + from pylons import config + config['__file__'] +except: + # can use config['__file__'] here, i.e. the Pylons + # ini file, instead of alembic.ini + config_file = options.get_main_option('pylons_config_file') + config_file = options.config_file_name + logging.config.fileConfig(config_file) + wsgi_app = loadapp('config:%s' % config_file, relative_to='.') # customize this section for non-standard engine configurations. meta = __import__("%s.model.meta" % config['pylons.package']).model.meta