@@ -23,14 +23,14 @@ Overview
23
23
In this guide, you can learn how to configure your Django project's
24
24
connection to MongoDB.
25
25
26
- Connection Configuration
26
+ Connection Configuration
27
27
------------------------
28
28
29
29
After installing {+django-odm+} and creating a project, you can configure
30
30
your connection to MongoDB in the following ways:
31
31
32
32
- :ref:`django-connection-configure-manual` by specifying the
33
- ``DATABASES`` variable in your project's settings.
33
+ ``DATABASES`` setting in your project's settings.
34
34
- :ref:`django-connection-configure-automatic` by using
35
35
the ``parse_uri()`` function.
36
36
@@ -44,10 +44,9 @@ your connection to MongoDB in the following ways:
44
44
Manually Configure Database Settings
45
45
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
46
47
- To manually configure your connection to MongoDB, update
48
- the ``DATABASES`` variable in your project's ``settings.py``
49
- file. Set the ``DATABASES`` variable to a dictionary value containing
50
- the ``default`` key, as shown in the following example:
47
+ To manually configure your connection to MongoDB, update the
48
+ ``DATABASES`` setting in your project's ``settings.py`` file. Set it to
49
+ a dictionary containing the ``default`` key:
51
50
52
51
.. code-block:: python
53
52
@@ -71,7 +70,7 @@ This nested dictionary has the following keys:
71
70
- The backend driver to use for the connection. Set this key to ``"django_mongodb_backend"``.
72
71
73
72
* - **HOST**
74
- - | Your connection URI. For localhost connections, this key is optional.
73
+ - | Your connection URI. For localhost connections, this key is optional.
75
74
| For SRV connections, you must include a scheme prefix (``mongodb+srv://``).
76
75
|
77
76
| To specify more than one host, include all hostnames in one string. Use
@@ -101,11 +100,10 @@ This nested dictionary has the following keys:
101
100
102
101
.. _django-manual-config-example:
103
102
104
- Example
103
+ Example
105
104
```````
106
105
107
- In this example, the ``DATABASES`` variable performs the
108
- following actions:
106
+ In this example, the ``DATABASES`` setting performs the following actions:
109
107
110
108
- Sets the database to ``my_database``
111
109
- Provides authentication information for a database user
@@ -147,15 +145,15 @@ function accepts the following arguments:
147
145
- ``uri``: Your MongoDB connection URI.
148
146
- ``db_name``: The name of the database you want to use.
149
147
- ``conn_max_age``: Configures persistent database connections.
150
- This argument is optional. To learn more, see
148
+ This argument is optional. To learn more, see
151
149
`Persistent connections <{+django-docs+}/ref/databases/#persistent-database-connections>`__
152
150
in the {+framework+} documentation.
153
151
- ``test``: Provides a dictionary of settings for test
154
- databases. This argument is optional. To learn more, see
152
+ databases. This argument is optional. To learn more, see
155
153
`the TEST setting <{+django-docs+}/ref/settings/#test>`__
156
154
in the {+framework+} documentation.
157
155
158
- Example
156
+ Example
159
157
```````
160
158
161
159
The following example uses the ``parse_uri()`` function to specify
@@ -177,4 +175,4 @@ see the :ref:`django-get-started-connect` step in the Getting Started
177
175
tutorial.
178
176
179
177
To learn more about {+framework+} settings, see `Settings <{+django-docs+}/ref/settings/>`__
180
- in the {+framework+} documentation.
178
+ in the {+framework+} documentation.
0 commit comments