Opened 13 months ago
Last modified 2 weeks ago
#36533 assigned Bug
manage.py startapp <name> <directory> fails to create new app
| Reported by: | Kenneth Love | Owned by: | Django Sprints |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | 5.2 |
| Severity: | Normal | Keywords: | startapp |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
Current 5.2 documentation says that manage.py startapp name destination should create a new app in the destination directory. This _does_ work with django-admin but fails with manage.py.
Steps to reproduce
- Create a new virtual environment with
uv venv - Install Django with
uv pip install django - Create a new Django project with
uv run django-admin startproject example_project cdintoexample_project- Create a new destination directory with
mkdir destination - Create a new app in the
destinationdirectory withuv run manage.py startapp example destination - Get the error:
CommandError: 'destination' conflicts with the name of an existing Python module and cannot be used as an app directory. Please try another directory.
Expectation
A new Django app named example would be created in the destination directory.
Change History (7)
comment:1 by , 13 months ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 13 months ago
comment:3 by , 13 months ago
| Has patch: | set |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
comment:4 by , 13 months ago
| Patch needs improvement: | set |
|---|
comment:5 by , 13 months ago
I think this is the expected behaviour, since you already created the directory destination
so you must remove the directory destination before running the startapp command.
comment:6 by , 7 months ago
Hi,
I’d like to work on this ticket if it’s still available. I’ve reproduced the issue on Django 5.2 and confirmed that django-admin startapp works as documented, while manage.py startapp fails due to a module conflict check being applied to the destination directory.
My plan is to align manage.py startapp with django-admin by ensuring the conflict check applies to the app name, not the destination path, and to add a regression test for both cases.
If that approach sounds reasonable and the ticket isn’t already being actively worked on, I’d be happy to take it.
Thanks.
comment:7 by , 2 weeks ago
| Owner: | changed from to |
|---|
Assigning to Django Sprints for to reserve for an upcoming sprint. DjangoCon US ends August 28, this is available for someone else to pick up on the 29th.
jefferies917, if you'd like to continue to work on this please re-assign this to yourself.
Hi everyone,
I am a new contributor to Django. I have recently resolved an easy pickings bug ticket and am looking for my next ticket to work on. I came across this ticket and it seems like an interesting issue to work on. Before beginning, I wanted to check whether this would be a suitable task for someone at my stage. I am still getting familiar with the codebase, but I am willing to put in the time to understand the issue thoroughly and work through and involved complexity.
Would this be a good ticket for me to work on, or would you recommend looking for something else?
Thanks in advance for the guidance