startapp时出现 CommandError错误
startapp时出现 CommandError: 'xxxxx' conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name.错误
原因可能是在settings.py中加入了
sys.path.append(os.path.join(BASE_DIR, 'app'))
解决办法,先将上面这行代码注释掉
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'django_filters',
'users',
'goods',
'order',
'ckeditor',
'ckeditor_uploader',
]
并将创建的应用名称前,加上路径app,例如'app.users'
再使用 python manage.py startapp app_name ./apps/app_name 创建
startapp成功后,修改回去可以了