Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#24519 closed Cleanup/optimization (fixed)

Language mismatch (word: project) between tutorial01 and tutorial02

Reported by: Kevin Conway Owned by: Panos Katseas
Component: Documentation Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Tutorial01 defines a project as "a collection of configuration and apps for a particular Web site" which specifically refers to the Python package generated by "django-admin startproject <project name>".

In tutorial02, while modifying the look and feel of the admin page, the guide asks the user to create a "templates" directory within the project and add "TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]" to the settings.py which is also within the project. However, the "BASE_DIR" value resolves to the directory containing the django project Python package rather than the Python package itself as the default value is "os.path.dirname(os.path.dirname(__file__))".

The documentation should clarify in tutorial02 whether project refers to the django project or the containing directory.

Attachments (1)

24519.diff (999 bytes) - added by Tim Graham 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years ago by Panos Katseas

Owner: changed from nobody to Panos Katseas
Status: newassigned

comment:2 Changed 4 years ago by Panos Katseas

Has patch: set

comment:3 Changed 4 years ago by Kevin Conway

This patch is a good addition. It only partially resolves the issue, though.

I'm pretty sure putting the templates next to the settings.py _is_ the correct step, but the default BASE_DIR points to the directory _above_ the settings.py. This means, in order to successfully complete tutorial02, you have to place the templates outside of the code, in the repository root.

If placing the templates within the project Python package is correct, you also need to modify the TEMPLATES_DIRS = [os.path.join(BASE_DIR, 'templates')] line to something more like TEMPLATES_DIRS = [os.path.join(BASE_DIR, 'project_directory', 'templates')].

comment:4 Changed 4 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

The "project directory" refers to the outer "mysite" directory, not the inner one. See the reusable app tutorial for the final layout. Attaching a suggested patch.

Changed 4 years ago by Tim Graham

Attachment: 24519.diff added

comment:5 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 6a2f46f2:

[1.8.x] Fixed #24519 -- Clarified location of templates directory in tutorial 2.

Backport of 2acf9d099d29f45c829ee0127e55b7cfdd201995 from master

comment:6 Changed 4 years ago by Tim Graham <timograham@…>

In da07f4b0:

[1.7.x] Fixed #24519 -- Clarified location of templates directory in tutorial 2.

Backport of 2acf9d099d29f45c829ee0127e55b7cfdd201995 from master

comment:7 Changed 4 years ago by Tim Graham <timograham@…>

In 2acf9d09:

Fixed #24519 -- Clarified location of templates directory in tutorial 2.

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