如何在 Django 的两个不同目录中拥有模型声明?
我在包含“ init .py”、“models.py”和“admin.py”的目录代码中有模型。它单独工作正常。
我想要目录历史,其中包含给定问题的修订模型。我在目录中有类似的文件。
我需要告诉 Django 以某种方式使用目录“History”中的模型,因为我在表 Questions 中与另一个目录有 ManyToMany 关系。
我收到以下导入错误
ImportError at /
cannot import name history
Request Method: GET
Request URL: http://127.0.0.1:8000/
Exception Type: ImportError
Exception Value:
cannot import name history
Exception Location: /home/noa/build/CML/../CML/codes/models.py in <module>, line 2
Python Executable: /usr/bin/python
Python Version: 2.6.2
Python Path: ['/home/noa/build/CML', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/gtk-2.0', '/var/lib/python-support/python2.6/pyinotify', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode', '/usr/local/lib/python2.6/dist-packages']
Server time: Fri, 11 Dec 2009 15:46:30 -0600