ImportError: No module named django.core.management 这个报错怎么破?
来源:
Edward_han
2017-01-13
在学习第四章数据库设计,新建apps包存放各app那一节遇到问题
在CMD下运行如下命令报错
C:\Users\Edward\PycharmProjects\MxOnline>python manage.py runserver 0.0.0.0:8000
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
---------------------------------------------------------------------------------
已经在setting中设置好 :sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))
manage.py中的代码如下:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MxOnline.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
------------------------------------------------------------
stackoverflow.com提供的解决办法如下,不知用哪个
http://stackoverflow.com/questions/14013728/django-no-module-named-django-core-management
1回答
-
你这个是没有安装django, 看看是否切换到虚拟环境下
162018-04-08
相似问题