Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ bug ]登录报错 #1489

Closed
liujing1087 opened this issue May 5, 2022 · 5 comments · Fixed by #1502
Closed

[ bug ]登录报错 #1489

liujing1087 opened this issue May 5, 2022 · 5 comments · Fixed by #1502

Comments

@liujing1087
Copy link

在提交 issue 前,请查阅以下资源,请先进行搜索来保证没有类似的 issue。
文档 | FAQ

重现步骤

v1.8.3升级到v1.8.4

错误日志

启动服务
[2022-05-05 10:51:03 +0800] [43] [INFO] Starting gunicorn 20.0.4
[2022-05-05 10:51:03 +0800] [43] [INFO] Listening at: http://127.0.0.1:8888 (43)
[2022-05-05 10:51:03 +0800] [43] [INFO] Using worker: sync
[2022-05-05 10:51:03 +0800] [44] [INFO] Booting worker with pid: 44
[2022-05-05 10:51:03 +0800] [45] [INFO] Booting worker with pid: 45
[2022-05-05 10:51:04 +0800] [46] [INFO] Booting worker with pid: 46
[2022-05-05 10:51:04 +0800] [47] [INFO] Booting worker with pid: 47
/opt/venv4archery/lib/python3.9/site-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
"class": algorithms.Blowfish,
[2022-05-05 10:51:22 +0800] [47] [ERROR] Error handling request /login/
Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/base.py", line 167, in _get_response
callback, callback_args, callback_kwargs = self.resolve_request(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/base.py", line 290, in resolve_request
resolver_match = resolver.resolve(request.path_info)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 549, in resolve
for pattern in self.url_patterns:
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 593, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/deprecation.py", line 114, in call
response = response or self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/gunicorn/workers/sync.py", line 134, in handle
self.handle_request(listener, req, client, addr)
File "/opt/venv4archery/lib/python3.9/site-packages/gunicorn/workers/sync.py", line 175, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 133, in call
response = self.get_response(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/base.py", line 130, in get_response
response = self._middleware_chain(request)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 103, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/exception.py", line 141, in handle_uncaught_exception
callback, param_dict = resolver.resolve_error_handler(500)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 606, in resolve_error_handler
callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
File "/opt/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 586, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/archery/urls.py", line 7, in
path('api/', include(('sql_api.urls', 'sql_api'), namespace="sql_api")),
File "/opt/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/archery/sql_api/urls.py", line 7, in
from . import api_user, api_instance, api_workflow
File "/opt/archery/sql_api/api_user.py", line 6, in
from .pagination import CustomizedPagination
File "/opt/archery/sql_api/pagination.py", line 7, in
class CustomizedPagination(PageNumberPagination):
File "/opt/archery/sql_api/pagination.py", line 11, in CustomizedPagination
page_size = settings.REST_FRAMEWORK['PAGE_SIZE'] if 'PAGE_SIZE' in settings.REST_FRAMEWORK.keys() else 20
File "/opt/venv4archery/lib/python3.9/site-packages/django/conf/init.py", line 83, in getattr
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'REST_FRAMEWORK'

版本信息

应用版本/分支:v1.8.4

部署方式:Docker

@nick2wang
Copy link
Collaborator

nick2wang commented May 5, 2022

settings新加了一些配置更新了么?

from datetime import timedelta

'rest_framework',
'django_filters',
'drf_spectacular',

Archery/archery/settings.py

Lines 179 to 220 in 21a2ba2

# API Framework
REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
'DEFAULT_RENDERER_CLASSES': ('rest_framework.renderers.JSONRenderer',),
# 鉴权
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
# 权限
'DEFAULT_PERMISSION_CLASSES': ('sql_api.permissions.IsInUserWhitelist',),
# 限速(anon:未认证用户 user:认证用户)
'DEFAULT_THROTTLE_CLASSES': (
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.UserRateThrottle',
),
'DEFAULT_THROTTLE_RATES': {
'anon': '120/min',
'user': '600/min'
},
# 过滤
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
# 分页
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 5,
}
# Swagger UI
SPECTACULAR_SETTINGS = {
'TITLE': 'Archery API',
'DESCRIPTION': 'OpenAPI 3.0',
'VERSION': '1.0.0',
}
# API Authentication
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(hours=4),
'REFRESH_TOKEN_LIFETIME': timedelta(days=3),
'ALGORITHM': 'HS256',
'SIGNING_KEY': SECRET_KEY,
'AUTH_HEADER_TYPES': ('Bearer',),
}

@thcoffee
Copy link
Contributor

thcoffee commented May 6, 2022

呵呵,我昨天升级也这样了。setting.py里要加一些内容。 还有初始化一些sql。

@liujing1087
Copy link
Author

集成LDAP登录后,对默认的admin账号开启2FA二次认证,登录报错

[2022-05-06 10:03:49,828][MainThread:140137242519360][task_id:default][exception_logging_middleware.py:11][ERROR]- Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/contrib/auth/init.py", line 111, in login
backend = backend or user.backend
AttributeError: 'Users' object has no attribute 'backend'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/venv4archery/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/venv4archery/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/venv4archery/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/opt/venv4archery/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/opt/venv4archery/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/opt/venv4archery/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/opt/archery/sql_api/api_user.py", line 340, in post
login(request, user)
File "/opt/venv4archery/lib/python3.9/site-packages/django/contrib/auth/init.py", line 117, in login
raise ValueError(
ValueError: You have multiple authentication backends configured and therefore must provide the backend argument or set the backend attribute on the user.

@nick2wang
Copy link
Collaborator

LDAP问题已修复 #1494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants