Skip to content

Commit cf95ddd

Browse files
committed
Document the CONNECT=False parameter
1 parent 851e987 commit cf95ddd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ Connection settings may also be provided individually by prefixing the setting w
7474
app.config['MONGODB_USERNAME'] = 'webapp'
7575
app.config['MONGODB_PASSWORD'] = 'pwd123'
7676

77+
By default flask-mongoengine open the connection when extension is instanciated but you can configure it
78+
to open connection only on first database access by setting the ``MONGODB_SETTINGS['connect']`` parameter
79+
or its ``MONGODB_CONNECT`` flat equivalent to ``False``::
80+
81+
app.config['MONGODB_SETTINGS'] = {
82+
'host': 'mongodb://localhost/database_name',
83+
'connect': False,
84+
}
85+
# or
86+
app.config['MONGODB_CONNECT'] = False
7787

7888
Custom Queryset
7989
===============

0 commit comments

Comments
 (0)