#python #django #django-rest-framework
#python #django #django-rest-framework
Вопрос:
У меня есть приложение Django, которое отлично работает некоторое время после каждого развертывания, но через некоторое время я получаю эту ошибку,
[Wed Sep 09 14:05:54.904121 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] Traceback (most recent call last):
[Wed Sep 09 14:05:54.904124 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup
[Wed Sep 09 14:05:54.904127 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] current = current[int(bit)]
[Wed Sep 09 14:05:54.904129 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] ValueError: invalid literal for int() with base 10: 'exception_type'
[Wed Sep 09 14:05:54.904132 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756]
[Wed Sep 09 14:05:54.904135 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] During handling of the above exception, another exception occurred:
[Wed Sep 09 14:05:54.904137 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756]
[Wed Sep 09 14:05:54.904143 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup
[Wed Sep 09 14:05:54.904146 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] (bit, current)) # missing attribute
[Wed Sep 09 14:05:54.904163 2020] [wsgi:error] [pid 5256] [remote 10.0.2.132:60756] django.template.base.VariableDoesNotExist: Failed lookup for key [exception_type] in [{'True': True, 'False': False, 'None': None}, {'is_email': True, 'unicode_hint': '', 'frames': [], 'request': <WSGIRequest: POST '/api/jsonws/invoke'>, 'user_str': '[unable to retrieve the current user]', '...
и пользователи не могут войти в систему. Это приложение только для API. Я использую djangorestframework==3.10.3
и Django==2.2.7
. Пожалуйста, предложите решение этой проблемы.
Комментарии:
1. Есть ли обратная трассировка?
2. добавлена трассировка стека @theEpsilon.
3. django ищет
[exception_type]
. может быть, удалить ключ из списка, в котором он находится?4. @HarryMoreno не могли бы вы немного объяснить?
5. django ищет ключ с именем
exception_type
внутри[{'True': True, 'False': False, 'None': None}, {'is_email': True, 'unicode_hint': '', 'frames': [], 'request': <WSGIRequest: POST '/api/jsonws/invoke'>, 'user_str': '[unable to retrieve the current user]', '...
пожалуйста, поделитесь своим кодом, чтобы получить дополнительную помощь.