iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.64k stars 306 forks source link

cannot import name 'JWTSerializer' from 'dj_rest_auth.app_settings' #486

Closed OttoAndrey closed 1 year ago

OttoAndrey commented 1 year ago

Hi! I am migrating project from django-rest-auth to dj-rest-auth. And got this error ImportError: cannot import name 'JWTSerializer' from 'dj_rest_auth.app_settings' when trying open page with open-api generated by drf-spectacular

Problem here in rest_auth.py file

def get_token_serializer_class():
    from dj_rest_auth.app_settings import JWTSerializer, TokenSerializer  # raise erorr here :(

    if getattr(settings, 'REST_USE_JWT', False):
        return JWTSerializer
    else:
        return TokenSerializer

My setup django==4.1.7 dj-rest-auth==3.0.0

Can you help me?

mostaszewski commented 1 year ago

It is a bug due to the latest dj-rest-auth update (3.0.0). You can find more information here: https://github.com/tfranzel/drf-spectacular/issues/937

OttoAndrey commented 1 year ago

I got it. Thank you!