Opened 4 years ago

Closed 4 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: jezdez
Component: Core (Management commands) Version: master
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


The documentation at 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 Changed 4 years ago by ptone

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to ptone
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.4-beta-1 to SVN

comment:2 Changed 4 years ago by ptone

  • Has patch set

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 Changed 4 years ago by jezdez

  • Owner changed from ptone to jezdez
  • Severity changed from Normal to Release blocker

comment:4 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

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