Opened 10 months ago

Last modified 4 months ago

#36533 assigned Bug

manage.py startapp <name> <directory> fails to create new app

Reported by: Kenneth Love Owned by: jefferies917
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
  • cd into example_project
  • Create a new destination directory with mkdir destination
  • Create a new app in the destination directory with uv 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 (6)

comment:1 by Sarah Boyce, 10 months ago

Triage Stage: UnreviewedAccepted

comment:2 by Mridul, 10 months ago

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

comment:3 by jefferies917, 10 months ago

Has patch: set
Owner: set to jefferies917
Status: newassigned

comment:4 by Sarah Boyce, 10 months ago

Patch needs improvement: set

comment:5 by suhail vs, 10 months ago

I think this is the expected behaviour, since he already created the directory destination
so you must remove the directory destination before running the startapp command.

Version 0, edited 10 months ago by suhail vs (next)

comment:6 by Abhimanyu Singh Negi, 4 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.

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