Skip to content

Commit f5a9133

Browse files
committed
Update readme
1 parent fd1e6ec commit f5a9133

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,8 @@ $ python manage.py startapp myapp --template https://github.com/mongodb-labs/dja
103103

104104
### Configuring the `DATABASES` setting
105105

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:
116108

117109
```python
118110
DATABASES = {
@@ -129,6 +121,16 @@ DATABASES = {
129121
`OPTIONS` is an optional dictionary of parameters that will be passed to
130122
[`MongoClient`](https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html).
131123

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+
132134
Congratulations, your project is ready to go!
133135

134136
## Notes on Django QuerySets

0 commit comments

Comments
 (0)