From 9a60589732411b1b11a190114bc2a412c02d5fe2 Mon Sep 17 00:00:00 2001 From: Gabriel Lacroix Date: Sat, 24 Sep 2022 09:02:33 -0400 Subject: [PATCH] Make instructions runnable without tweaking (#1224) 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. ``` --- docs/tutorial-plain.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/tutorial-plain.rst b/docs/tutorial-plain.rst index 45927a510..43b6da9da 100644 --- a/docs/tutorial-plain.rst +++ b/docs/tutorial-plain.rst @@ -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... @@ -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: