Python ModuleNotFoundError:没有名为';mysite';当尝试呼叫django管理员时
在终端中运行命令Python ModuleNotFoundError:没有名为';mysite';当尝试呼叫django管理员时,python,python-3.x,django,django-models,Python,Python 3.x,Django,Django Models,在终端中运行命令django admin collectstatic时,我得到以下错误: ModuleNotFoundError: No module named 'mysite' 它甚至出现在列表的末尾django admincommands help Type 'django-admin help <subcommand>' for help on a specific subcommand. Available subcommands: [django] check
django admin collectstatic
时,我得到以下错误:
ModuleNotFoundError: No module named 'mysite'
它甚至出现在列表的末尾django admin
commands help
Type 'django-admin help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runserver
sendtestemail
shell
showmigrations
sqlflush
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
test
testserver
Note that only Django core commands are listed as settings are not properly configured (error: No module named 'mysite').
setting.py
BASE_DIR=os.path.dirname(os.path.dirname(os.path.abspath(u文件_uu)))
WSGI_应用程序='mysite.WSGI.APPLICATION'
wsgi.py
导入操作系统
从django.core.wsgi导入获取\u wsgi\u应用程序
os.environ.setdefault('DJANGO\u SETTINGS\u MODULE','mysite.SETTINGS')
application=get\u wsgi\u application()
在myside dir和myproject中创建\uuu init\uuuuuupy
文件,而不是django admin collectstatic
使用此命令
python manage.py collectstatic
参考此主题我不认为
mysite
文件夹中缺少\uuuu init\uuuuuuuuuuuuuuupy
,因为命令django admin startproject mysite
将用默认文件构建最小的项目结构,包括\uuuu init\uuuuuuuuuuuuuuuuuuuupy.py
,除非它被意外删除。它已在中初始化mysite文件夹,但不在myProject文件夹中
python manage.py collectstatic