Django, unable to create application in subfolder

I am on Windows and trying to create a new application inside a shared folder called Apps. The myApp folder already exists inside applications. I start from the root of the project:

python manage.py startapp myApp Apps\myApp 

and I get:

 Error: 'Apps\\myApp' is not a valid app name. Please use only numbers, letters and underscores. 

I do not know why this double backslash. I also tried with a slash:

 python manage.py startapp myApp Apps/myApp 

and I get the following:

 Error: 'myApp' conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name. 

I can't figure out if this is a Windows or Python issue.

+7
source share
5 answers

I had the same issue on my Mac.
I decided to upgrade it from Django version vivion 1.3 to version 1.4.

+2
source

Try the following:

 mkdir Apps\newapp python manage.py startapp NewApp Apps/newapp 

And you will create an application called "NewApp" inside the "Apps / newapp" folder.

+14
source

from documents:

If an additional destination is provided, Django will use this existing directory and not create a new one. You can use '.' to indicate the current working directory.
django-admin.py startapp myapp /Users/jezdez/Code/myapp

So try python manage.py startapp myApp ./Apps/myApp or with full path.

+5
source

Create an application folder

 mkdir Apps 

Go to the application directory

 cd Apps 

Run python by calling manage.py in the project root directory

 python ../manage.py startapp newapp 

Like this

+3
source

Manage.py file is a thin shell django-admin.py

In case you want to create a new application in any directory

Try it:

 $ cd <directory path> $ django-admin.py startapp <app-anme> 
0
source

Source: https://habr.com/ru/post/927466/


All Articles