#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)
Change History (8)
comment:1 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 10 years ago
Has patch: | set |
---|
comment:3 by , 10 years ago
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 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
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.
by , 10 years ago
Attachment: | 24519.diff added |
---|
Added pull request at: https://github.com/django/django/pull/4370