Skip to content

Commit

Permalink
Merge pull request #443 from scotchka/master
Browse files Browse the repository at this point in the history
warn user when SQLALCHEMY_DATABASE_URI is not set
  • Loading branch information
davidism authored Feb 25, 2017
2 parents 6c1f4a2 + 206e9b9 commit 9eff8b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flask_sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,13 @@ def init_app(self, app):
of an application not initialized that way or connections will
leak.
"""
app.config.setdefault('SQLALCHEMY_DATABASE_URI', 'sqlite://')
if 'SQLALCHEMY_DATABASE_URI' not in app.config:
warnings.warn(
'SQLALCHEMY_DATABASE_URI not set. Defaulting to '
'"sqlite:///:memory:".'
)

app.config.setdefault('SQLALCHEMY_DATABASE_URI', 'sqlite:///:memory:')
app.config.setdefault('SQLALCHEMY_BINDS', None)
app.config.setdefault('SQLALCHEMY_NATIVE_UNICODE', None)
app.config.setdefault('SQLALCHEMY_ECHO', False)
Expand Down

0 comments on commit 9eff8b6

Please sign in to comment.