python 创建app 报重复app名报错解决

来源:互联网 时间:2017-06-01


删除创建的 project 及app 后重新创建 app后报

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


From the django-admin docs

( does essentially the same thing as django-admin)

startapp [destination]

django-admin startapp

Creates a Django app directory structure for the given app name in the current directory or the given destination.

By default the directory created contains a file and other app template files. (See the source for more details.) If only the app name is given, the app directory will be created in the current working directory.

If the optional destination is provided, Django will use that existing directory rather than creating a new one. You can use ‘.’ to denote the current working directory.

For example:

django-admin startapp myapp /Users/jezdez/Code/myapp


# first create a Project (container). startproject Project
# create multiple apps
cd Project
python startapp polls
python startapp hello