Django TypeError: issubclass() arg 1 must be a class. Caused by from rest_framework.authtoken.views import ObtainAuthToken in

I wrote the following view in Django to serialize the obtained token. However, I get error. I Could not get a similar issue on internet, most of the post were related to tests.

from rest_framework import generics
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings

from user.serializers import UserSerializer
from user.serializers import (

class CreateUserView(generics.CreateAPIView):
    """Create a new user in the system."""
    serializer_class = UserSerializer

class CreateTokenView(ObtainAuthToken):
    """Create a new auth token for user."""
    serializer_class = AuthTokenSerializer
    renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES

After running docker-compose I get following error:

eMenue_1    |   File "/app/eMenue/user/", line 5, in <module>
eMenue_1    |     from user import views
eMenue_1    |   File "/app/eMenue/user/", line 5, in <module>
eMenue_1    |     from rest_framework.authtoken.views import ObtainAuthToken
eMenue_1    |   File "/usr/local/lib/python3.10/site-packages/rest_framework/authtoken/", line 11, in <module>
eMenue_1    |     class ObtainAuthToken(APIView):
eMenue_1    |   File "/usr/local/lib/python3.10/site-packages/rest_framework/authtoken/", line 18, in ObtainAuthToken
eMenue_1    |     if coreapi_schema.is_enabled():
eMenue_1    |   File "/usr/local/lib/python3.10/site-packages/rest_framework/schemas/", line 612, in is_enabled
eMenue_1    |     return issubclass(api_settings.DEFAULT_SCHEMA_CLASS, AutoSchema)
eMenue_1    | TypeError: issubclass() arg 1 must be a class

Any idea what can cause that plese?

Back to Top