Opened 2 years ago

Last modified 2 years ago

#33890 closed Bug

call_command('startproject', 'project_name', '.') raises CommandError 'project_name' — at Initial Version

Reported by: piscvau Owned by: nobody
Component: Core (Management commands) Version: 4.0
Severity: Normal Keywords: call_command raises exception
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

call_command ('startproject', 'project_name', '.') shoud create a project named 'project_name' in the current directory.

to reproduce the bug :
from django.core import management
from pathlib import Path
project_name = Path.cwd().stem
management.call_command('startproject', project_name, '.')

This raises the exception

django.core.management.base.CommandError: <project_name> conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.

This is because the initial directory of the python script is in sys.module.

Change History (0)

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