File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -103,16 +103,8 @@ $ python manage.py startapp myapp --template https://github.com/mongodb-labs/dja
103
103
104
104
### Configuring the ` DATABASES ` setting
105
105
106
- After you've set up a project, configure Django's ` DATABASES ` with
107
- ` django_mongodb.parse(uri) ` :
108
-
109
- ``` python
110
- MONGODB_URI = " mongodb://<my_user>:<my_password>@localhost:27017/my_database"
111
- DATABASES [" default" ] = django_mongodb.parse(MONGODB_URI )
112
- ```
113
-
114
- Alternatively, if you prefer to edit the Python dictionary directly, you can
115
- configure the nested keys and values of the ` DATABASES ` setting individually:
106
+ After you've set up a project, configure Django's ` DATABASES ` setting similar
107
+ to this:
116
108
117
109
``` python
118
110
DATABASES = {
@@ -129,6 +121,16 @@ DATABASES = {
129
121
` OPTIONS ` is an optional dictionary of parameters that will be passed to
130
122
[ ` MongoClient ` ] ( https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html ) .
131
123
124
+ Alternatively, you can configure Django's ` DATABASES ` with
125
+ ` django_mongodb.parse(uri) ` :
126
+
127
+ ``` python
128
+ import django_mongodb
129
+
130
+ MONGODB_URI = " mongodb://<my_user>:<my_password>@localhost:27017/my_database"
131
+ DATABASES [" default" ] = django_mongodb.parse(MONGODB_URI )
132
+ ```
133
+
132
134
Congratulations, your project is ready to go!
133
135
134
136
## Notes on Django QuerySets
You can’t perform that action at this time.
0 commit comments