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

错误场景:

 删除创建的 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

(manage.py does essentially the same thing as django-admin)

startapp <app_label> [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 models.py 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).
django-admin.py startproject Project

# create multiple apps
cd Project
python manage.py startapp polls
python manage.py startapp hello

参考:

https://stackoverflow.com/questions/7019070/cannot-start-any-django-app

 

转载于:https://my.oschina.net/zhiyonghe/blog/911191

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值