AssertionError at /api-auth/login/ database connection isn't set to UTC
cgl0408 opened this issue · 3 comments
錯誤訊息是甚麼呢?
web_1 | Traceback (most recent call last): web_1 | File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner web_1 | response = get_response(request) web_1 | File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response web_1 | response = self.process_exception_by_middleware(e, request) web_1 | File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response web_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view web_1 | return self.dispatch(request, *args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper web_1 | return bound_func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper web_1 | return view(request, *args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func web_1 | return func.__get__(self, type(self))(*args2, **kwargs2) web_1 | File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper web_1 | return bound_func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 149, in _wrapped_view web_1 | response = view_func(request, *args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func web_1 | return func.__get__(self, type(self))(*args2, **kwargs2) web_1 | File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper web_1 | return bound_func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func web_1 | response = view_func(request, *args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func web_1 | return func.__get__(self, type(self))(*args2, **kwargs2) web_1 | File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/views.py", line 90, in dispatch web_1 | return super(LoginView, self).dispatch(request, *args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch web_1 | return handler(request, *args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/views/generic/edit.py", line 182, in post web_1 | if form.is_valid(): web_1 | File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 183, in is_valid web_1 | return self.is_bound and not self.errors web_1 | File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 175, in errors web_1 | self.full_clean() web_1 | File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 385, in full_clean web_1 | self._clean_form() web_1 | File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 412, in _clean_form web_1 | cleaned_data = self.clean() web_1 | File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/forms.py", line 202, in clean web_1 | self.user_cache = authenticate(self.request, username=username, password=password) web_1 | File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 70, in authenticate web_1 | user = _authenticate_with_backend(backend, backend_path, request, credentials) web_1 | File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 116, in _authenticate_with_backend web_1 | return backend.authenticate(*args, **credentials) web_1 | File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/backends.py", line 18, in authenticate web_1 | user = UserModel._default_manager.get_by_natural_key(username) web_1 | File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 48, in get_by_natural_key web_1 | return self.get(**{self.model.USERNAME_FIELD: username}) web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method web_1 | return getattr(self.get_queryset(), name)(*args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 374, in get web_1 | num = len(clone) web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 232, in __len__ web_1 | self._fetch_all() web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 1121, in _fetch_all web_1 | self._result_cache = list(self._iterable_class(self)) web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 62, in __iter__ web_1 | for row in compiler.results_iter(results): web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 844, in results_iter web_1 | for rows in results: web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1289, in cursor_iter web_1 | sentinel): web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1288, in <lambda> web_1 | for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 101, in inner web_1 | return func(*args, **kwargs) web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/utils.py", line 6, in utc_tzinfo_factory web_1 | raise AssertionError("database connection isn't set to UTC") web_1 | AssertionError: database connection isn't set to UTC
關鍵字應該是:AssertionError: database connection isn't set to UTC
@abc225313
我稍微測試了一下
只需要改成 psycopg2==2.8.6
就可以了哦(我已經 push 了) b5cdadef1be4
你應該是出在 docker 的問題.
你修改成 psycopg2==2.8.6
之後,
在資料夾路徑底下執行以下的指令
docker-compose down -v
docker-compose build --no-cache
docker-compose up -d
之後再重新你之前的流程.