Skip to content

Instantly share code, notes, and snippets.

@jeanphix
Created December 1, 2011 20:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeanphix/1419502 to your computer and use it in GitHub Desktop.
Save jeanphix/1419502 to your computer and use it in GitHub Desktop.
alembic / flask-sqlalchemy (alembic/env.py)
import os
import sys
from alembic import context
from sqlalchemy import engine_from_config
from logging.config import fileConfig
sys.path.append(os.getcwd())
from models import metadata
from myapp import app
config = context.config
config.set_main_option('sqlalchemy.url', app.config['SQLALCHEMY_DATABASE_URI'])
fileConfig(config.config_file_name)
target_metadata = metadata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment