djangorestframework-simplejwt icon indicating copy to clipboard operation
djangorestframework-simplejwt copied to clipboard

I have set AllowAny for the registration view in Django, but it still triggers a User.DoesNotExist error. How can I handle this error and ensure successful registration?

Open Friedrich-hue opened this issue 1 year ago • 2 comments

I have set AllowAny for the registration view in Django, but it still triggers a User.DoesNotExist error. How can I handle this error and ensure successful registration?

Friedrich-hue avatar Aug 08 '23 08:08 Friedrich-hue

# settings.py
REST_FRAMEWORK = {
    'EXCEPTION_HANDLER': 'main.exceptions.exception_handler',
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.BasicAuthentication',
        'rest_framework_simplejwt.authentication.JWTAuthentication',
        'rest_framework.authentication.TokenAuthentication',
        'rest_framework.authentication.SessionAuthentication',
    ],
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.IsAuthenticated',
    ],
    'DEFAULT_SCHEMA_RENDERER': 'rest_framework.schemas.coreapi.AutoSchema',
    'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'DEFAULT_FILTER_BACKENDS': [
        'django_filters.rest_framework.DjangoFilterBackend'
    ],
    'PAGE_SIZE': 10
}

Friedrich-hue avatar Aug 08 '23 08:08 Friedrich-hue

@Friedrich-hue can you share your registration view !!!

bonface221 avatar Oct 02 '23 08:10 bonface221