Opened 11 years ago

Closed 11 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: master
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


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 Changed 11 years ago by mrts

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 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 Changed 11 years ago by James Bennett

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