Opened 17 years ago

Closed 16 years ago

#7424 closed (wontfix)

Near mentions of TEMPLATE_DIRS absolute path, include tip dynamic absolute path

Reported by: Jeff Kowalczyk <jtk@…> Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords: path template absolute
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Most documentation of settings.TEMPLATE_DIRS instructs the user to use absolute paths, in the form of a hardcoded string literal absolute path.

A new user would immediately wonder if they needed to plan their deployment absolute path right then and there.

To avoid this surprise, it would be helpful to note that the absolute path can be created dynamically, such as with:

 TEMPLATE_DIRS = (os.path.join(os.path.abspath(os.path.dirname(__file__)), 'templates'),)

Change History (2)

comment:1 by mrts, 17 years ago

Triage Stage: UnreviewedAccepted

+1 from me. The absolute path is useful in other places as well (DATABASE_NAME for sqlite and MEDIA_ROOT), so I personally always put

{{
import os
PROJDIR = os.path.dirname(os.path.abspath(file))
}}

into settings.py and use PROJDIR where absolute path is required.

Marking as accepted as projects can not be really used in different environments without this.

comment:2 by James Bennett, 16 years ago

Resolution: wontfix
Status: newclosed

Listing everything you might do in this setting (which is the road this is heading down) isn't really efficient or useful. Also, re-using a settings file without changes in multiple environments isn't necessarily a design goal -- settings will always, at least to some extent, be specific to the environment in which Django is being deployed.

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