Skip to content

Commit

Permalink
Make instructions runnable without tweaking (#1224)
Browse files Browse the repository at this point in the history
Introduces two changes to make sure the instructions in the tutorial don't require debugging:

- Add `cd ..` when first syncing the database so that `manage.py` is accessible in the working directory.
- Change `cookbook.ingredients.apps.IngredientsConfig.name` to `cookbook.ingredients` from `ingredients` to prevent the following exception:

  ```python
django.core.exceptions.ImproperlyConfigured: Cannot import 'ingredients'. Check that 'cookbook.ingredients.apps.IngredientsConfig.name' is correct.
```
  • Loading branch information
Gadiguibou authored Sep 24, 2022
1 parent 0b2cc4e commit 9a60589
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/tutorial-plain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Now sync your database for the first time:

.. code:: bash
cd ..
python manage.py migrate
Let's create a few simple models...
Expand Down Expand Up @@ -77,6 +78,18 @@ Add ingredients as INSTALLED_APPS:
"cookbook.ingredients",
]
Make sure the app name in ``cookbook.ingredients.apps.IngredientsConfig`` is set to ``cookbook.ingredients``.

.. code:: python
# cookbook/ingredients/apps.py
from django.apps import AppConfig
class IngredientsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'cookbook.ingredients'
Don't forget to create & run migrations:

Expand Down

1 comment on commit 9a60589

@ak7991
Copy link

@ak7991 ak7991 commented on 9a60589 Apr 23, 2023

Choose a reason for hiding this comment

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

The tutorial still doesn't show the change needed in cookbook.ingredients.apps.IngredientsConfig. Hope this gets deployed and reflected on the documentation page.

Please sign in to comment.