Opened 4 years ago

Closed 4 years ago

#17503 closed Bug (fixed)

startproject can't create new project directly in current working directory

Reported by: carljm Owned by: carljm
Component: Core (Management commands) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The current fix for #17042, although it allows more flexibility with regard to where startproject and startapp create the new app/project, doesn't actually meet the original use case that motivated that ticket. Several people (including at least one or two core devs) had expressed the wish to be able to take an existing directory that they had already created (for instance, initialized as a vcs repo) and convert it into a stock Django project using startproject. But the current implementation of the optional second argument to startproject doesn't allow you to ever reuse an existing directory, it always creates a new one and just allows you to specify where it will do so. To make it clearer with an example:

Current behavior:

$ mkdir /home/carljm/target
$ django-admin.py startproject someproj /home/carljm/target
$ tree /home/carljm/target/
/home/carljm/target/
`-- someproj
    |-- manage.py
    `-- someproj
        |-- __init__.py
        |-- settings.py
        |-- urls.py
        `-- wsgi.py

Desired behavior:

$ mkdir /home/carljm/target
$ django-admin.py startproject someproj /home/carljm/target
/home/carljm/target/
|-- manage.py
`-- someproj
    |-- __init__.py
    |-- settings.py
    |-- urls.py
    `-- wsgi.py

Jannis (author of r17246, the fix for #17042) agreed on IRC that this behavior could be changed to meet the original use case.

Change History (1)

comment:1 Changed 4 years ago by carljm

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

In [17340]:

Fixed #17503 -- A destination directory passed to startproject or startapp as optional second argument is now reused as the project/app directory, rather than a new project/app directory created within it. Refs #17042.

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