老师您好,我执行run manage.py task的时候 报了个导入错误

来源:3-3 django orm介绍与model设计

精慕门1599776

2018-05-17

Failed to get real commands on module "DemoDjango": python process died with code 1: Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pycharm/_jb_manage_tasks_provider.py", line 25, in <module>
    django.setup()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
    module = import_module(entry)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named message

写回答

2回答

精慕门1599776

提问者

2018-05-17

老师,问题已经解决了 把message文件拉到根目录就没问题了,看来是没有找到apps下的message

0
1
bobby
好的,
2018-05-18
共1条回复

精慕门1599776

提问者

2018-05-17

是不是因为我把message放在了apps目录下 系统没有找到?但是我marked apps文件夹为source root了

0
1
不务正业的码农
你在IDE里mark没用,命令行不认。在Installed app里加“apps.message”别只加message
2018-06-11
共1条回复

Python3.6+django+xadmin,打造在线教育平台

【毕设】Python 2.7到3.6 完美适配,Django升级2.0

3677 学习 · 4038 问题

查看课程