'Import issue in Djoser- Django

I'm trying to build an user authentication system with React and Django. I'm using JWT, Djoser for authentication model.

serializers.py:

from djoser.serializers import UserCreateSerializer
from django.contrib.auth import get_user_model

User = get_user_model()


class UserCreateSerializer(UserCreateSerializer):
class Meta(UserCreateSerializer.Meta):
    model = User
    fields = ("id", "email", "name", "password")

settings.py:

DJOSER = {
'LOGIN_FIELD': 'email',
'USER_CREATE_PASSWORD_RETYPE': True,
'USERNAME_CHANGED_EMAIL_CONFIRMATION': True,
'PASSWORD_CHANGED_EMAIL_CONFIRMATION': True,
'SEND_CONFIRMATION_EMAIL': True,
'SET_USERNAME_RETYPE': True,
'SET_PASSWORD_RETYPE': True,
'PASSWORD_RESET_CONFIRM_URL': 'password/reset/confirm/{uid},{token}',
'USERNAME_RESET_CONFIRM_URL': 'email/reset/confirm/{uid},{token}',
'ACTIVATION_URL': 'activate/{uid}{token}',
'SEND_ACTIVATION_EMAIL': True,
'SERIALIZERS': {
    'user_create': 'accounts.serializers.UserCreateSerializer',
    'user': 'accounts.serializers.UserCreateSerializer',
    'user_delete': 'djoser.serializers.UserDeleteSerializer',  
}
}

But I get import error for Djoser,

Import "djoser.serializers" could not be resolved

I have tried changing names but nothing helped. The package isn't importing. I can edit and add more things like models.py and other things if they are necessary. Any help is appreciated. I have already installed djoser, jwt, drf, drf-simple and other packages. I tried reinstalling too.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source