def load_config(): conf = Config() module = os.environ.get("SANIC_SETTINGS_MODULE", "settings") if module: path = "%s.py" % module.replace(".", "/") conf.from_pyfile(path) return conf
def load_config(): conf = Config() module = os.environ.get('SANIC_SETTINGS_MODULE', 'settings') if module: path = '%s.py' % module.replace('.', '/') conf.from_pyfile(path) return conf
def load_config(): conf = Config() module = os.environ.get('SANIC_CONFIG_MODULE', None) if module: path = '%s.py' % module.replace('.', '/') conf.from_pyfile(path) else: import sanicms.config conf.from_object(config) return conf
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ alembic_config = config.get_section(config.config_ini_section) app_config_file = config.get_section('app')['config_file'] app_config = Config() app_config.from_pyfile(app_config_file) alembic_config['sqlalchemy.url'] = app_config.DATABASE_URL engine = engine_from_config(alembic_config) with engine.connect() as connection: context.configure(connection=connection, target_metadata=target_metadata) with context.begin_transaction(): context.run_migrations()