#31849: django-admin startproject - Fails to create files after encountering
CommandErrror
-------------------------------------+-------------------------------------
     Reporter:  iamdirk              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Management     |                  Version:  3.0
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:  django-admin,        |             Triage Stage:
  startproject, CommandError, file   |  Unreviewed
  creation, settings.py, asgi.py,    |
  Poetry                             |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by iamdirk:

Old description:

> Ubuntu 20.04 LTS, Python 3.8.3, Django 3.0.8, Poetry setup VENV
>
> Inside a poetry generated virtual environment with only the following
> dependencies and their required dependencies:
> {{{
> [tool.poetry.dependencies]
> python = "^3.8"
> django = "~3.0"
> }}}
>
> I have a poetry initialized project setup, which has generated the
> following structure.
> {{{
> (devenv-demo-Iq-p0dca-py3.8) d@devpad:~/development/devenv_demo$ find .
> .
> ./poetry.lock
> ./pyproject.toml
> ./tests
> ./tests/__init__.py
> ./tests/test_devenv_demo.py
> ./devenv_demo
> ./devenv_demo/__init__.py
> ./README.rst
> }}}
>
> The only overlapping file is inside our devenv_demo directory:
> {{{
> __init__.py
> }}}
> Which contains a single line of text:
> {{{
> __version__ = '0.1.0'
> }}}
>
> Upon running the following command we run into CommandError:
> {{{
> (devenv-demo-Iq-p0dca-py3.8) d@devpad:~/development/devenv_demo$ django-
> admin startproject devenv_demo .
> CommandError: /home/d/development/devenv_demo/devenv_demo/__init__.py
> already exists. Overlaying a project into an existing directory won't
> replace conflicting files.
> }}}
>
> This still causes some of the template files to be created by
> startproject:
> {{{
> (devenv-demo-Iq-p0dca-py3.8) d@devpad:~/development/devenv_demo$ find .
> .
> ./manage.py
> ./poetry.lock
> ./pyproject.toml
> ./tests
> ./tests/__init__.py
> ./tests/test_devenv_demo.py
> ./devenv_demo
> ./devenv_demo/urls.py
> ./devenv_demo/wsgi.py
> ./devenv_demo/__init__.py
> ./README.rst
> }}}
>
> However as it encounters an already the existing __init__.py it fails and
> stops creating more files since we are still missing:
> {{{
> ./devenv_demo/settings.py
> ./devenv_demo/asgi.py
> }}}
>

> According to: https://docs.djangoproject.com/en/3.0/intro/tutorial01/
>
> Removing the conflicting file ensures complete normal functionality of
> 'django-admin startproject'.

New description:

 Ubuntu 20.04 LTS, Python 3.8.3, Django 3.0.8, Poetry setup VENV

 Inside a poetry generated virtual environment with only the following
 dependencies and their required dependencies:
 {{{
 [tool.poetry.dependencies]
 python = "^3.8"
 django = "~3.0"
 }}}

 I have a poetry initialized project setup, which has generated the
 following structure.
 {{{
 (devenv-demo-Iq-p0dca-py3.8) d@devpad:~/development/devenv_demo$ find .
 .
 ./poetry.lock
 ./pyproject.toml
 ./tests
 ./tests/__init__.py
 ./tests/test_devenv_demo.py
 ./devenv_demo
 ./devenv_demo/__init__.py
 ./README.rst
 }}}

 The only overlapping file is inside our devenv_demo directory:
 {{{
 __init__.py
 }}}
 Which contains a single line of text:
 {{{
 __version__ = '0.1.0'
 }}}

 Upon running the following command we run into CommandError:
 {{{
 (devenv-demo-Iq-p0dca-py3.8) d@devpad:~/development/devenv_demo$ django-
 admin startproject devenv_demo .
 CommandError: /home/d/development/devenv_demo/devenv_demo/__init__.py
 already exists. Overlaying a project into an existing directory won't
 replace conflicting files.
 }}}

 This still causes some of the template files to be created by
 startproject:
 {{{
 (devenv-demo-Iq-p0dca-py3.8) d@devpad:~/development/devenv_demo$ find .
 .
 ./manage.py
 ./poetry.lock
 ./pyproject.toml
 ./tests
 ./tests/__init__.py
 ./tests/test_devenv_demo.py
 ./devenv_demo
 ./devenv_demo/urls.py
 ./devenv_demo/wsgi.py
 ./devenv_demo/__init__.py
 ./README.rst
 }}}

 However as it encounters the overlapping file it fails and stops creating
 files since we are still missing:
 {{{
 ./devenv_demo/settings.py
 ./devenv_demo/asgi.py
 }}}


 According to: https://docs.djangoproject.com/en/3.0/intro/tutorial01/

 Removing the conflicting file ensures complete normal functionality of
 'django-admin startproject'.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31849#comment:1>
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/065.d2295185a59eddd1d864ee5ed5d96a70%40djangoproject.com.

Reply via email to