python manage.py shell问题

来源:7-7 modelform提交我要学习咨询1

guoyumo

2017-06-19

老师,在用shell测试的时候,导入models报错.

Traceback (most recent call last):

  File "/home/yumo/workvenv/d2.7/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2882, in run_code

    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-2-2664a6f07ed2>", line 1, in <module>

    from apps.organization.models import Courseorg

  File "/home/yumo/Downloads/pycharm-2017.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import

    module = self._system_import(name, *args, **kwargs)

  File "/home/yumo/myproject/Mxonline2/apps/organization/models.py", line 7, in <module>

    class CityDict(models.Model):

  File "/home/yumo/workvenv/d2.7/local/lib/python2.7/site-packages/django/db/models/base.py", line 102, in __new__

    "INSTALLED_APPS." % (module, name)

RuntimeError: Model class apps.organization.models.CityDict doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.


请问这是什么原因啊

写回答

1回答

bobby

2017-06-20

你这里通过pycharm运行有没有问题? 你给我发个qq消息 我给你看一下吧

0
5
bobby
回复
guoyumo
对 因为设置了setting的原因
2017-07-05
共5条回复

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

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

3677 学习 · 4038 问题

查看课程