Ошибка объявления ярлыка приложения для пакета django oauth2_provider
Я пытаюсь обновить версию django с 1.8 до 3.2.
моя конфигурация корневого URL определена как:
ROOT_URLCONF = 'clickwork.urls'
в settings.py
Внутри файла urls у меня есть этот импорт:
from django.conf import settings
import oauth2_provider.views as oauth2_views
from django.contrib import admin
admin.autodiscover()
утверждение импорта ouath2provider вызывает ошибку app_label:
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Вот что я пытался сделать, чтобы решить проблему:
- Upgrading the oauthprovider package to the latest version 1.5, it supports Django 2.2+ as per their docs.
https://github.com/jazzband/django-oauth-toolkit
- Adding apps.py file in the root directory and adding the path to the project config in INSTALLED_APPS in settings, this is mentioned in the Django 3.2 release notes:
https://docs.djangoproject.com/en/3.2/ref/applications/#configuring-applications-ref
- I went through the
django.contrib.contenttypes.models.ContentType
class code and added an app label, it was not there before:
class ContentType(models.Model):
app_label = models.CharField(max_length=100)
model = models.CharField(_('python model class name'), max_length=100)
objects = ContentTypeManager()
class Meta:
verbose_name = _('content type')
verbose_name_plural = _('content types')
db_table = 'django_content_type'
unique_together = [['app_label', 'model']]
Выполнение шага 3 решает проблему, но очевидно, что менять код в пакете глупо.
Может ли кто-нибудь подсказать мне, что я делаю неправильно и где и как app_label должен быть определен с обновлением Django, в настоящее время в Django 1.8 он нигде не определен.