Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django, can't create app in subfolder

I'm on windows and trying to create a new app inside a common folder named Apps. The myApp folder already exists inside Apps. I'm running from the project root:

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 don't know why that double backslash. I tried also with a forward slash just to be sure:

python manage.py startapp myApp Apps/myApp

and I get this:

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 understand if it is a Windows or a Python problem.

like image 678
Leonardo Avatar asked Oct 11 '12 14:10

Leonardo


2 Answers

Try this:

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

And you will to create a app called "NewApp" inside folder "Apps/newapp".

like image 104
Ricardo Carmo Avatar answered Oct 06 '22 20:10

Ricardo Carmo


Create your Apps directory from your project's root directory-

mkdir Apps

Move to your Apps directory-

cd Apps

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

python ../manage.py startapp newapp

There you go

like image 35
Roy Ryando Avatar answered Oct 06 '22 19:10

Roy Ryando