iMerica / dj-rest-auth

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

Getting ConnectionRefusedError when register a new user. But the user saving to database. If I refresh the page, showing user exists. #631

Open MuhammadAnas47 opened 1 month ago

MuhammadAnas47 commented 1 month ago

ConnectionRefusedError at /dj-rest-auth/registration/

[Errno 111] Connection refused
Request Method: POST

http://127.0.0.1:8000/dj-rest-auth/registration/ 5.0.4 ConnectionRefusedError [Errno 111] Connection refused /usr/lib/python3.10/socket.py, line 833, in create_connection dj_rest_auth.registration.views.RegisterView /usr/bin/python3 3.10.12 ['/home/code/Documents/playground/backend/backEndApps/testDJmodelAndViews/testmodelandviews', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/home/code/.local/lib/python3.10/site-packages', '/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages']

MuhammadAnas47 commented 1 month ago

Internal Server Error: /dj-rest-auth/registration/ Traceback (most recent call last): File "/home/code/.local/lib/python3.10/site-packages/asgiref/sync.py", line 534, in thread_handler raise exc_info[1] File "/home/code/.local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 42, in inner response = await get_response(request) File "/home/code/.local/lib/python3.10/site-packages/django/core/handlers/base.py", line 253, in _get_response_async response = await wrapped_callback( File "/home/code/.local/lib/python3.10/site-packages/asgiref/sync.py", line 479, in call ret: _R = await loop.run_in_executor( File "/home/code/.local/lib/python3.10/site-packages/asgiref/current_thread_executor.py", line 40, in run result = self.fn(*self.args, self.kwargs) File "/home/code/.local/lib/python3.10/site-packages/asgiref/sync.py", line 538, in thread_handler return func(*args, *kwargs) File "/home/code/.local/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper return view_func(request, args, kwargs) File "/home/code/.local/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, *args, kwargs) File "/home/code/.local/lib/python3.10/site-packages/django/utils/decorators.py", line 48, in _wrapper return bound_method(*args, *kwargs) File "/home/code/.local/lib/python3.10/site-packages/django/views/decorators/debug.py", line 143, in sensitive_post_parameters_wrapper return view(request, args, kwargs) File "/home/code/.local/lib/python3.10/site-packages/dj_rest_auth/registration/views.py", line 42, in dispatch return super().dispatch(*args, kwargs) File "/home/code/.local/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/home/code/.local/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/home/code/.local/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/home/code/.local/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, *kwargs) File "/home/code/.local/lib/python3.10/site-packages/rest_framework/generics.py", line 194, in post return self.create(request, args, kwargs) File "/home/code/.local/lib/python3.10/site-packages/dj_rest_auth/registration/views.py", line 64, in create user = self.perform_create(serializer) File "/home/code/.local/lib/python3.10/site-packages/dj_rest_auth/registration/views.py", line 90, in perform_create complete_signup( File "/home/code/.local/lib/python3.10/site-packages/allauth/account/utils.py", line 192, in complete_signup return perform_login( File "/home/code/.local/lib/python3.10/site-packages/allauth/account/utils.py", line 159, in perform_login return flows.login.perform_login(request, login) File "/home/code/.local/lib/python3.10/site-packages/allauth/account/internal/flows/login.py", line 36, in perform_login return resume_login(request, login) File "/home/code/.local/lib/python3.10/site-packages/allauth/account/internal/flows/login.py", line 50, in resume_login response = adapter.post_login(request, login.user, hook_kwargs) File "/home/code/.local/lib/python3.10/site-packages/allauth/account/adapter.py", line 479, in post_login signals.user_logged_in.send( File "/home/code/.local/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 189, in send response = receiver(signal=self, sender=sender, named) File "/home/code/.local/lib/python3.10/site-packages/allauth/usersessions/signals.py", line 8, in on_user_logged_in UserSession.objects.create_from_request(request) File "/home/code/.local/lib/python3.10/site-packages/allauth/usersessions/models.py", line 25, in create_from_request raise ValueError() ValueError HTTP POST /dj-rest-auth/registration/ 500 [0.53, 127.0.0.1:59546]

The full log from terminal. Hope this helps.