我创建了新的应用程序python first_project/manage.py startapp first_app
,并在此之后将应用程序添加到 INSTALLED_APPS。
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'first_app']
在python first_project/manage.py runserver
得到错误之后:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fe13745f6a8>
...
ImportError: No module named 'first_app'
为什么我不能添加应用程序?
该first_app
目录应与manage.py
.
运行python first_project/manage.py
可能在错误的地方创建了它。通常情况下,你会切换到同一个目录manage.py
,然后运行python manage.py
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句