Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn user when SQLALCHEMY_DATABASE_URI is not set #443

Merged
merged 2 commits into from
Feb 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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