#34157 closed Cleanup/optimization (invalid)

Error on Tutorial 2nd page: mysite/settings.py | Code is incorrect

Reported by: Johnson Deng Owned by: nobody
Component: Documentation Version: 4.1
Severity: Normal Keywords: tutorial, documentation, instructions,
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In the Database portion of the tutorial: https://docs.djangoproject.com/en/4.1/intro/tutorial02/#activating-models, The included code to copy produces an error.
"polls.apps.PollsConfig" at the top of the list does not work and returns and error. But when "polls.apps.PollsConfig" is moved to the bottom of the list, the makemigration polls command works as intended.

Correct code for users to copy:

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    **'polls.apps.PollsConfig'**
]

Incorrect Code to copy:

INSTALLED_APPS = [
 **'polls.apps.PollsConfig'**
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
]

Change History (1)

comment:1 by Tim Graham, 18 months ago

Resolution: invalid
Status: newclosed

What's the error? I think it's more likely that you made a mistake somewhere. In this ticket description, there's no comma after 'polls.apps.PollsConfig' like there should be, so maybe that's it.

Note: See TracTickets for help on using tickets.
Back to Top