Skip to content
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
10 changes: 7 additions & 3 deletions flask_mongoengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def __init__(self, app=None, config=None):
_include_mongoengine(self)

self.app = None
self.config = config
self.Document = Document
self.DynamicDocument = DynamicDocument

Expand All @@ -121,9 +122,12 @@ def init_app(self, app, config=None):
# potentially new configuration would not be loaded.
raise ValueError("Extension already initialized")

if not config:
# If not passed a config then we read the connection settings
# from the app config.
if config:
# Passed config have max priority, over init config.
self.config = config

if not self.config:
# If no configs passed, use app.config.
config = app.config

# Obtain db connection(s)
Expand Down