Skip to content

DOCSP-43200: Get started with Django #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion source/django-get-started/django-connect-mongodb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

DATABASES = {
"default": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is incorrect throughout these documents (only 3 spaces).

"ENGINE": "django_mongodb",
"ENGINE": "django_mongodb_backend",
"NAME": "sample_mflix",
"USER": "<username>",
"PASSWORD": "<password>",
Expand All @@ -89,7 +89,7 @@

python3 manage.py runserver

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is consistent with the rest of your documentation and you want to leave it alone, but if you are working in a Python 3 virtual environment, you can write python without the 3. Coming from Django's docs, it looks odd to include that 3 on all commands.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to raise this too, but would defer to MongoDB-wide conventions. If there are no such conventions, then I prefer python too.


Then, visit http://127.0.0.1:8000/. This page displays a "Congratulations!"

Check failure on line 92 in source/django-get-started/django-connect-mongodb.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.Time24h2Digits] Show the hours, minutes, and seconds with two digits each, even if the leading digit is 0 ('1:8'). Raw Output: {"message": "[MongoDB.Time24h2Digits] Show the hours, minutes, and seconds with two digits each, even if the leading digit is 0 ('1:8').", "location": {"path": "source/django-get-started/django-connect-mongodb.txt", "range": {"start": {"line": 92, "column": 34}}}, "severity": "ERROR"}
message and an image of a rocket.

After completing these steps, you have a Django project configured
Expand Down
4 changes: 2 additions & 2 deletions source/django-get-started/django-create-app.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
.. note:: App Template

The ``django-mongodb-app`` template ensures that your ``app.py`` file
includes the line ``"default_auto_field = 'django_mongodb.fields.ObjectIdAutoField'"``.
includes the line ``"default_auto_field = 'django_mongodb_backend.fields.ObjectIdAutoField'"``.

.. step:: Create models for movie, awards, and viewer data

Expand All @@ -46,7 +46,7 @@
.. code-block:: python

from django.db import models
from django_mongodb.fields import EmbeddedModelField, ArrayField
from django_mongodb_backend.fields import EmbeddedModelField, ArrayField
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the EmbeddedModelField import and the awards Movie field below will cause errors until this PR is merged


class Movie(models.Model):
title = models.CharField(max_length=200)
Expand Down Expand Up @@ -243,7 +243,7 @@
.. step:: Create migrations for your new models

From your project root, run the following command to create
migrations for the ``Movie``, ``Award``, and ``Viewer`` models and apply

Check failure on line 246 in source/django-get-started/django-create-app.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.CommaOxford] Use the Oxford comma in ' migrations for the ``Movie``, ``Award``, and ``Viewer`` models and '. Raw Output: {"message": "[MongoDB.CommaOxford] Use the Oxford comma in ' migrations for the ``Movie``, ``Award``, and ``Viewer`` models and '.", "location": {"path": "source/django-get-started/django-create-app.txt", "range": {"start": {"line": 246, "column": 1}}}, "severity": "ERROR"}
the changes to the database:

.. code-block:: bash
Expand Down
2 changes: 1 addition & 1 deletion source/django-get-started/django-install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

.. tip::

In the preceding commands, you might need to replace

Check failure on line 53 in source/django-get-started/django-install.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.ConciseTerms] 'must' is preferred over 'need to'. Raw Output: {"message": "[MongoDB.ConciseTerms] 'must' is preferred over 'need to'.", "location": {"path": "source/django-get-started/django-install.txt", "range": {"start": {"line": 53, "column": 47}}}, "severity": "ERROR"}
``python3`` with the command that points to your Python
3.10+ interpreter.

Expand All @@ -61,7 +61,7 @@

.. code-block:: bash

pip install git+https://github.com/mongodb-labs/django-mongodb
pip install git+https://github.com/mongodb-labs/django-mongodb-backend

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alpha release is now on PyPI, so maybe this should be pip install django-mongodb-backend. 🤔


This command also installs the following dependencies:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also those dependencies' dependencies but quite possibly not worth mentioning.

  • asgiref
  • dnspython
  • sqlparse
django-mongodb-backend v5.0a1
├── django v5.0.10
│   ├── asgiref v3.8.1
│   └── sqlparse v0.5.3
├── pymongo v4.10.1
│   └── dnspython v2.7.0


Expand Down
Loading