Opened 13 years ago

Closed 13 years ago

#17920 closed Bug (fixed)

Templates with startproject or startapp do not render project_directory or app_directory correctly

Reported by: gw.2012@… Owned by: Jannis Leidel
Component: Core (Management commands) Version: dev
Severity: Release blocker Keywords: startproject startapp templates
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation at https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-startproject states that template files may contain the tag project_directory that should contain the full path of the newly created project. Similarly with startapp and app_directory.

This is not exactly true in case you are specifying the destination directory yourself. The project_directory variable gets exactly the value specified as the parameter and in case of relative paths (or even ".") it is not *a full path* of the newly created project.

Either the documentation should be changed (although the behavour is then inconsistent) or a full path resolving functionality implemented. Maybe it could also be implemented as a full path relative to a virtualenv or other environment it is contained in.

Change History (4)

comment:1 by Preston Holmes, 13 years ago

Owner: changed from nobody to Preston Holmes
Triage Stage: UnreviewedAccepted
Version: 1.4-beta-1SVN

comment:2 by Preston Holmes, 13 years ago

Has patch: set

https://github.com/django/django/pull/127

In addition to fixing this issue with the path the patch also:

tests other context variables
adds a clearer error if the target does not exist, currently this results in an IOError when trying to read the render a file out to non-existant location

I'm not sure though whether the target shouldn't just be created if it doesn't exist?

comment:3 by Jannis Leidel, 13 years ago

Owner: changed from Preston Holmes to Jannis Leidel
Severity: NormalRelease blocker

comment:4 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

In [17773]:

Fixed #17920 -- Actually pass the full path of a newly created project or app in the template context as mentioned in the startproject docs. Many thanks to Preston Holmes for the initial patch.

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