Describe the bug
When login in as an admin user created using manage.py, I get tracebacks from alcali:
2021-05-17 01:07:31 -0500] [3437990] [DEBUG] POST /api/token/
Internal Server Error: /api/token/
Traceback (most recent call last):
File "/opt/alcali/.venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/opt/alcali/.venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/alcali/.venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/alcali/.venv/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/alcali/.venv/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework_simplejwt/views.py", line 27, in post
serializer.is_valid(raise_exception=True)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 234, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 436, in run_validation
value = self.validate(value)
File "/opt/alcali/code/api/serializers.py", line 152, in validate
data = super().validate(attrs)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework_simplejwt/serializers.py", line 75, in validate
data['refresh'] = str(refresh)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework_simplejwt/tokens.py", line 82, in __str__
return token_backend.encode(self.payload)
File "/opt/alcali/.venv/lib/python3.6/site-packages/rest_framework_simplejwt/backends.py", line 43, in encode
return token.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
Solved this. I had set the formula to use the master branch assuming it'd be the most recent version (it was not). I set to v3003.1.0 and resolved the issue.
Describe the bug When login in as an admin user created using manage.py, I get tracebacks from alcali:
To Reproduce Steps to reproduce the behavior:
(.venv) [alcali@host code]$ ./manage.py createsuperuser
(.venv) [alcali@host code]$ /opt/alcali/.venv/bin/gunicorn config.wsgi:application --bind 0.0.0.0:5001 -w 8 -t 300 --log-level debug
Attempt to log into Alcali at http://192.0.2.1:5001/#/login
See error
Expected behavior To be logged into alcali
Additional context Running on CentOS 8