#33890: call_command('startproject', 'project_name', '.') raises CommandError
'project_name'
-------------------------------------+-------------------------------------
Reporter: piscvau | Owner: nobody
Type: Bug | Status: closed
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution: invalid
Keywords: call_command raises | Triage Stage:
exception | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by piscvau:
Old 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.
New 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.
When called from the command line, in the exact same condition, the
command passes :
in directory project_name :
django-admin startproject project-name .
in django docs it is described as the right usage to create a project
project_name in the current directory!....
SO I do believe this is a bug!.....
--
--
Ticket URL: <https://code.djangoproject.com/ticket/33890#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070182653e440d-fbbcd2aa-dc72-4432-8b01-c69046118620-000000%40eu-central-1.amazonses.com.