gpt4 book ai didi

python - Django 1.9.2 断言错误 : database connection isn't set to UTC

转载 作者:太空狗 更新时间:2023-10-30 00:01:52 24 4
gpt4 key购买 nike

我现在已经用 PostgreSQL 安装了 3 个服务器,到目前为止还没有看到这个问题。我现在正在设置第一台未在丹麦服务器上运行的服务器,并且在从 Web 访问数据库时开始出现错误。

我可以毫无问题地使用 createsuperuser,它创建了我的 super 用户。但是,当我尝试使用它登录我的网站时,出现错误。

File "/usr/lib64/python3.4/site-packages/django/db/models/sql/compiler.py",    line 1239, in cursor_iter
sentinel):
File "/usr/lib64/python3.4/site-packages/django/db/models/sql/compiler.py", line 1238, in <lambda>
for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
File "/usr/lib64/python3.4/site-packages/django/db/utils.py", line 102, in inner
return func(*args, **kwargs)
File "/usr/lib64/python3.4/site-packages/django/db/backends/postgresql/utils.py", line 6, in utc_tzinfo_factory
raise AssertionError("database connection isn't set to UTC")
AssertionError: database connection isn't set to UTC

我一直在看代码,错误来自这段代码。

from django.utils.timezone import utc
def utc_tzinfo_factory(offset):
if offset != 0:
raise AssertionError("database connection isn't set to UTC")
return utc

虽然我找不到启动偏移量的位置,所以我无法弄清楚 Django 是如何决定我的偏移量关闭的。

我的 postgresql 数据库将时区设置为 UTC,并验证了 django 文档中编写的所有 postgresql 参数,我现在想不通为什么会发生这种情况。

我希望这里有人能帮忙吗?

python3.4 -V: Python 3.4.3

psql -V: psql (PostgreSQL) 9.2.15

django-admin --version: 1.9.2

已更新 11/8-2016 - 从 DEBUG View 查看完整堆栈

我在 utc_tzinfo_factory 中找到了偏移值,它的值为 120。虽然我无法解释它是如何或为什么得到这个值的。

以下是 Django 调试页面的副本,用于包含完整堆栈和变量的错误。

Environment:


Request Method: POST
Request URL: http://myweb.dk/accounts/login/

Django Version: 1.9.2
Python Version: 3.4.3
Installed Applications:
['polls.apps.PollsConfig',
'teamTournamentApp.apps.TeamtournamentappConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "/usr/lib64/python3.4/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)

File "/usr/lib64/python3.4/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/lib64/python3.4/site-packages/django/contrib/auth/views.py" in inner
49. return func(*args, **kwargs)

File "/usr/lib64/python3.4/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)

File "/usr/lib64/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)

File "/usr/lib64/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)

File "/usr/lib64/python3.4/site-packages/django/contrib/auth/views.py" in login
69. if form.is_valid():

File "/usr/lib64/python3.4/site-packages/django/forms/forms.py" in is_valid
161. return self.is_bound and not self.errors

File "/usr/lib64/python3.4/site-packages/django/forms/forms.py" in errors
153. self.full_clean()

File "/usr/lib64/python3.4/site-packages/django/forms/forms.py" in full_clean
363. self._clean_form()

File "/usr/lib64/python3.4/site-packages/django/forms/forms.py" in _clean_form
390. cleaned_data = self.clean()

File "/usr/lib64/python3.4/site-packages/django/contrib/auth/forms.py" in clean
159. password=password)

File "/usr/lib64/python3.4/site-packages/django/contrib/auth/__init__.py" in authenticate
74. user = backend.authenticate(**credentials)

File "/usr/lib64/python3.4/site-packages/django/contrib/auth/backends.py" in authenticate
17. user = UserModel._default_manager.get_by_natural_key(username)

File "/usr/lib64/python3.4/site-packages/django/contrib/auth/base_user.py" in get_by_natural_key
45. return self.get(**{self.model.USERNAME_FIELD: username})

File "/usr/lib64/python3.4/site-packages/django/db/models/manager.py" in manager_method
122. return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/usr/lib64/python3.4/site-packages/django/db/models/query.py" in get
381. num = len(clone)

File "/usr/lib64/python3.4/site-packages/django/db/models/query.py" in __len__
240. self._fetch_all()

File "/usr/lib64/python3.4/site-packages/django/db/models/query.py" in _fetch_all
1074. self._result_cache = list(self.iterator())

File "/usr/lib64/python3.4/site-packages/django/db/models/query.py" in __iter__
68. for row in compiler.results_iter(results):

File "/usr/lib64/python3.4/site-packages/django/db/models/sql/compiler.py" in results_iter
805. for rows in results:

File "/usr/lib64/python3.4/site-packages/django/db/models/sql/compiler.py" in cursor_iter
1239. sentinel):

File "/usr/lib64/python3.4/site-packages/django/db/models/sql/compiler.py" in <lambda>
1238. for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),

File "/usr/lib64/python3.4/site-packages/django/db/utils.py" in inner
102. return func(*args, **kwargs)

File "/usr/lib64/python3.4/site-packages/django/db/backends/postgresql/utils.py" in utc_tzinfo_factory
6. raise AssertionError("database connection isn't set to UTC")

Exception Type: AssertionError at /accounts/login/
Exception Value: database connection isn't set to UTC

Request information

GET
No GET data
POST
Variable Value
next
''
password
'xxxxxxx'
username
'admin'
csrfmiddlewaretoken
'f8E50d9kpS2j4Wlc7O9KsKtUXHxbuX58'
FILES
No FILES data
COOKIES
Variable Value
_ga
'GA1.2.1308578855.1465289038'
csrftoken
'f8E50d9kpS2j4Wlc7O9KsKtUXHxbuX58'
META
Variable Value
UNIQUE_ID
'xxxxx'
HTTP_USER_AGENT
('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like '
'Gecko) Chrome/51.0.2704.103 Safari/537.36')
mod_wsgi.total_requests
1
REMOTE_ADDR
'xx.yy.zz.tt'
mod_wsgi.handler_script
''
mod_wsgi.script_name
''
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
REQUEST_SCHEME
'http'
mod_wsgi.script_start
'1470934394985429'
HTTP_REFERER
'http://myweb.dk/accounts/login/'
mod_wsgi.version
(4, 5, 3)
SERVER_PROTOCOL
'HTTP/1.1'
HTTP_HOST
'myweb.dk'
wsgi.url_scheme
'http'
HTTP_ACCEPT_ENCODING
'gzip, deflate'
PATH_INFO
'/accounts/login/'
wsgi.multiprocess
True
HTTP_CONNECTION
'keep-alive'
mod_wsgi.listener_port
'80'
mod_wsgi.path_info
'/accounts/login/'
CONTEXT_DOCUMENT_ROOT
'/var/www/vhosts/default/htdocs'
REMOTE_PORT
'59723'
wsgi.errors
<_io.TextIOWrapper encoding='utf-8'>
mod_wsgi.callable_object
'application'
SCRIPT_NAME
''
REQUEST_URI
'/accounts/login/'
SCRIPT_FILENAME
'/var/www/vhosts/myweb.dk/httpdocs/TeamTournament/TeamTournament/wsgi.py'
SERVER_ADMIN
'.....'
mod_wsgi.request_start
'1470934394985053'
mod_wsgi.listener_host
''
mod_wsgi.enable_sendfile
'0'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
mod_wsgi.script_reloading
'1'
SERVER_SIGNATURE
''
mod_wsgi.application_group
'myweb.dk|'
mod_wsgi.thread_requests
0
wsgi.input
<mod_wsgi.Input object at 0x7f6266286920>
QUERY_STRING
''
SERVER_ADDR
'xx.yy.zz.tt'
wsgi.multithread
True
wsgi.version
(1, 0)
CONTEXT_PREFIX
''
wsgi.run_once
False
REQUEST_METHOD
'POST'
HTTP_ORIGIN
'http://myweb.dk'
SERVER_NAME
'myweb.dk'
mod_wsgi.request_handler
'wsgi-script'
mod_wsgi.process_group
''
CONTENT_TYPE
'application/x-www-form-urlencoded'
HTTP_CACHE_CONTROL
'max-age=0'
SERVER_SOFTWARE
'Apache'
HTTP_COOKIE
'_ga=GA1.2.1308578855.1465289038; csrftoken=f8E50d9kpS2j4Wlc7O9KsKtUXHxbuX58'
HTTP_ACCEPT_LANGUAGE
'da-DK,da;q=0.8,en-US;q=0.6,en;q=0.4,sv;q=0.2'
SERVER_PORT
'80'
wsgi.file_wrapper
''
apache.version
(2, 4, 6)
PATH_TRANSLATED
'/var/www/vhosts/myweb.dk/httpdocs/TeamTournament/TeamTournament/wsgi.py/accounts/login/'
CONTENT_LENGTH
'91'
mod_wsgi.thread_id
2
CSRF_COOKIE
'f8E50d9kpS2j4Wlc7O9KsKtUXHxbuX58'
GATEWAY_INTERFACE
'CGI/1.1'
DOCUMENT_ROOT
'/var/www/vhosts/default/htdocs'
Settings
Using settings module TeamTournament.settings
Setting Value
LOGIN_REDIRECT_URL
'/accounts/profile/'
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
SECURE_SSL_HOST
None
DATETIME_FORMAT
'N j, Y, P'
EMAIL_HOST
'localhost'
SESSION_COOKIE_PATH
'/'
FORMAT_MODULE_PATH
None
DEFAULT_TABLESPACE
''
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
TEMPLATE_DIRS
[]
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%Y-%m-%d',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%Y',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M',
'%m/%d/%y']
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FIRST_DAY_OF_WEEK
0
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
SESSION_ENGINE
'django.contrib.sessions.backends.db'
TIME_FORMAT
'P'
FORCE_SCRIPT_NAME
None
SECURE_SSL_REDIRECT
False
ALLOWED_INCLUDE_ROOTS
[]
SHORT_DATETIME_FORMAT
'm/d/Y P'
DEFAULT_CONTENT_TYPE
'text/html'
NUMBER_GROUPING
0
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
LANGUAGE_CODE
'en-us'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
SESSION_COOKIE_NAME
'sessionid'
ALLOWED_HOSTS
['xx.yy.zz.tt', 'myweb.net', 'myweb.dk']
SESSION_COOKIE_DOMAIN
None
EMAIL_SSL_CERTFILE
None
DEFAULT_FROM_EMAIL
'webmaster@localhost'
EMAIL_PORT
25
DATE_FORMAT
'N j, Y'
ABSOLUTE_URL_OVERRIDES
{}
USE_ETAGS
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
EMAIL_SSL_KEYFILE
'********************'
CSRF_COOKIE_HTTPONLY
False
SESSION_CACHE_ALIAS
'default'
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hu', 'Hungarian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmal'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('th', 'Thai'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
X_FRAME_OPTIONS
'SAMEORIGIN'
AUTH_USER_MODEL
'auth.User'
SILENCED_SYSTEM_CHECKS
[]
LOGOUT_URL
'/accounts/logout/'
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['/var/www/vhosts/myweb.dk/httpdocs/TeamTournament/templates'],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request']}}]
SERVER_EMAIL
'root@localhost'
SECURE_BROWSER_XSS_FILTER
False
TEMPLATE_CONTEXT_PROCESSORS
['django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages']
DEBUG_APPS
False
USE_X_FORWARDED_PORT
False
ADMINS
[]
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
CSRF_COOKIE_SECURE
False
EMAIL_USE_SSL
False
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
LOCALE_PATHS
[]
TEMPLATE_STRING_IF_INVALID
''
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
PRODUCTION
False
FIXTURE_DIRS
[]
CSRF_COOKIE_PATH
'/'
MIDDLEWARE_CLASSES
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
MANAGERS
[]
CSRF_TRUSTED_ORIGINS
[]
CACHE_MIDDLEWARE_SECONDS
600
APPEND_SLASH
True
TEST_NON_SERIALIZED_APPS
[]
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
MIGRATION_MODULES
{}
LANGUAGE_COOKIE_AGE
None
TEMPLATE_LOADERS
['django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader']
STATIC_URL
'/static/'
SESSION_COOKIE_AGE
1209600
SETTINGS_MODULE
'TeamTournament.settings'
DECIMAL_SEPARATOR
'.'
YEAR_MONTH_FORMAT
'F Y'
EMAIL_TIMEOUT
None
SESSION_SAVE_EVERY_REQUEST
False
BASE_DIR
'/var/www/vhosts/myweb.dk/httpdocs/TeamTournament'
SECURE_CONTENT_TYPE_NOSNIFF
False
FILE_UPLOAD_TEMP_DIR
None
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
DEBUG
True
SESSION_COOKIE_HTTPONLY
True
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
USE_L10N
True
STATICFILES_DIRS
[]
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
USE_THOUSAND_SEPARATOR
False
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
USE_X_FORWARDED_HOST
False
STATIC_ROOT
'/var/www/vhosts/myweb.dk/httpdocs/static/'
SECRET_KEY
'********************'
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
MEDIA_ROOT
''
TIME_ZONE
'CET'
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.postgresql',
'HOST': '127.0.0.1',
'NAME': 'user',
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '5432',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': 'user'}}
DEFAULT_INDEX_TABLESPACE
''
EMAIL_USE_TLS
False
LOGIN_URL
'/accounts/login/'
SHORT_DATE_FORMAT
'm/d/Y'
CSRF_COOKIE_NAME
'csrftoken'
LANGUAGE_COOKIE_DOMAIN
None
USE_I18N
True
SESSION_COOKIE_SECURE
False
CACHE_MIDDLEWARE_ALIAS
'default'
DEFAULT_CHARSET
'utf-8'
TEMPLATE_DEBUG
False
ROOT_URLCONF
'TeamTournament.urls'
SECURE_PROXY_SSL_HEADER
None
EMAIL_HOST_PASSWORD
'********************'
FILE_UPLOAD_PERMISSIONS
None
CSRF_COOKIE_AGE
31449600
DEBUG_PROPAGATE_EXCEPTIONS
False
WSGI_APPLICATION
'TeamTournament.wsgi.application'
PASSWORD_HASHERS
'********************'
SECURE_REDIRECT_EXEMPT
[]
LANGUAGES_BIDI
['he', 'ar', 'fa', 'ur']
CSRF_COOKIE_DOMAIN
None
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
POSTGRES
True
PREPEND_WWW
False
EMAIL_SUBJECT_PREFIX
'[Django] '
LOGGING
{'disable_existing_loggers': False,
'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}},
'handlers': {'logfile': {'class': 'logging.handlers.WatchedFileHandler',
'filename': '/var/log/django/error.log'},
'mail_admins': {'class': 'django.utils.log.AdminEmailHandler',
'filters': ['require_debug_false'],
'level': 'ERROR'}},
'loggers': {'django': {'handlers': ['logfile'],
'level': 'ERROR',
'propagate': False},
'django.request': {'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True}},
'version': 1}
SESSION_FILE_PATH
None
TEST_RUNNER
'django.test.runner.DiscoverRunner'
INTERNAL_IPS
[]
DATABASE_ROUTERS
[]
FILE_CHARSET
'utf-8'
LANGUAGE_COOKIE_NAME
'django_language'
INSTALLED_APPS
['polls.apps.PollsConfig',
'teamTournamentApp.apps.TeamtournamentappConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
LANGUAGE_COOKIE_PATH
'/'
IGNORABLE_404_URLS
[]
MEDIA_URL
''
DISALLOWED_USER_AGENTS
[]
LOG_PATH
'/var/log/django/error.log'
LOGGING_CONFIG
'logging.config.dictConfig'
THOUSAND_SEPARATOR
','
MONTH_DAY_FORMAT
'F j'
USE_TZ
True
EMAIL_HOST_USER
''
AUTH_PASSWORD_VALIDATORS
'********************'
SECURE_HSTS_SECONDS
0
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']

最佳答案

对于 18/06/2021,这是一个已知问题,来自 psycopg-2/psycopg2-binary包。幸运的是,他们已经有了一个open issue。在他们的 GitHub 页面上,希望它能尽快得到修复。

作为临时修复,您可以将版本固定在您的 requirements.txt 中至 psycopg2-binary>=2.8,<2.9psycopg2>=2.8,<2.9 ,具体取决于您使用的包。

感谢@vinkomlacic在评论中提到这一点。

关于python - Django 1.9.2 断言错误 : database connection isn't set to UTC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38807296/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com