Skip to content

Commit

Permalink
Allow db to be provided separately from the app
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Feb 24, 2016
1 parent 6f32154 commit d612c10
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flask_migrate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ def get_template_directory(self):
class Migrate(object):
def __init__(self, app=None, db=None, directory='migrations', **kwargs):
self.configure_callbacks = []
self.db = db
self.directory = directory
if app is not None and db is not None:
self.init_app(app, db, directory, **kwargs)

def init_app(self, app, db, directory=None, **kwargs):
def init_app(self, app, db=None, directory=None, **kwargs):
self.db = db or self.db
self.directory = directory or self.directory
if not hasattr(app, 'extensions'):
app.extensions = {}
Expand Down

0 comments on commit d612c10

Please sign in to comment.