1
我正在使用Django 1.8,並且我有一個應用程序在此上完美運行。但現在我遷移整個數據庫,每當我試圖在管理訪問記錄我得到這個錯誤:內容類型錯誤
Internal Server Error: /admin/mitglieder/mitglied/22/
Traceback (most recent call last):
File "/home/franzritt/django-club41/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/franzritt/django-club41/django/contrib/admin/options.py", line 583, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/franzritt/django-club41/django/utils/decorators.py", line 105, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/franzritt/django-club41/django/views/decorators/cache.py", line 52, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/franzritt/django-club41/django/contrib/admin/sites.py", line 206, in inner
return view(request, *args, **kwargs)
File "/home/franzritt/django-club41/django/contrib/admin/options.py", line 1456, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
File "/home/franzritt/django-club41/django/utils/decorators.py", line 29, in _wrapper
return bound_func(*args, **kwargs)
File "/home/franzritt/django-club41/django/utils/decorators.py", line 105, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/franzritt/django-club41/django/utils/decorators.py", line 25, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/franzritt/django-club41/django/db/transaction.py", line 394, in inner
return func(*args, **kwargs)
File "/home/franzritt/django-club41/django/contrib/admin/options.py", line 1450, in changeform_view
return self.render_change_form(request, context, add=add, change=not add, obj=obj, form_url=form_url)
File "/home/franzritt/django-club41/django/contrib/admin/options.py", line 1088, in render_change_form
'content_type_id': get_content_type_for_model(self.model).pk,
File "/home/franzritt/django-club41/django/contrib/admin/options.py", line 63, in get_content_type_for_model
return ContentType.objects.get_for_model(obj, for_concrete_model=False)
File "/home/franzritt/django-club41/django/contrib/contenttypes/models.py", line 58, in get_for_model
" is migrated before trying to migrate apps individually."
RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.
我曾與1.7開始的項目,但在我到1.8,一個應用程序沒有被運行問題。不過,我之前沒有遷移整個項目。我可以從遷移歷史中看到,此遷移對auth應用進行了遷移。但即使我在此之前遷移,我也會遇到同樣的錯誤。
在切換到1.8之前,我有這個或類似的錯誤,但它不是名稱字段的問題。而且我無法刪除數據庫中的django_content_types表,因爲auth已鏈接到此表。我能以某種方式解決此問題嗎?
我剛剛注意到,它運行的django版本似乎存在問題。它似乎仍然是1.7。將升級,看看它是否有效。 –