我在「project/apps/myapp」文件夾中安裝我的應用程序。這兩個應用程序和myapp文件夾都有init .py文件(沒有任何一個模塊缺少錯誤)。現在,我的錯誤:Django 1.7衝突模型
Exception Type: RuntimeError at/
Exception Value: Conflicting 'person' models in application 'resume': <class
'apps.resume.models.Person'> and <class 'resume.models.Person'>.
Django的進口機型相同的兩個不同的pathes。我該如何解決它?
完整的錯誤日誌:
Traceback:
File "/home/voxa/.virtualenvs/42-test/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
98. resolver_match = resolver.resolve(request.path_info)
File "/home/voxa/.virtualenvs/42-test/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
343. for pattern in self.url_patterns:
File "/home/voxa/.virtualenvs/42-test/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
372. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/voxa/.virtualenvs/42-test/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
366. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/home/voxa/django/FortyTwoTestTask/fortytwo_test_task/urls.py" in <module>
4. from resume import views
File "/home/voxa/django/FortyTwoTestTask/apps/resume/views.py" in <module>
4. from resume.models import Person
File "/home/voxa/django/FortyTwoTestTask/apps/resume/models.py" in <module>
3. class Person(models.Model):
File "/home/voxa/.virtualenvs/42-test/local/lib/python2.7/site-packages/django/db/models/base.py" in __new__
285. new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
File "/home/voxa/.virtualenvs/42-test/local/lib/python2.7/site-packages/django/apps/registry.py" in register_model
213. (model_name, app_label, app_models[model_name], model))
Exception Type: RuntimeError at/
Exception Value: Conflicting 'person' models in application 'resume': <class 'apps.resume.models.Person'> and <class 'resume.models.Person'>.
你有 「恢復」 無論是在_project/resume_和_project /應用/ resume_應用程序? – dukebody 2014-10-27 17:25:15
不僅「項目/應用程序/簡歷」 – Crampus 2014-10-27 17:51:00
你可以做'從apps.resume.models導入Person爲Person1;從resume.models導入Person作爲Person2;打印Person1 .__ file__;打印Person2 .__ file__'並在這裏發佈結果? – dukebody 2014-10-28 08:26:19