Answer the question
In order to leave comments, you need to log in
Django + Postgres: Why is there a "database connection isn't set to UTC" error?
settings.py
TIME_ZONE = 'Asia/Yekaterinburg'
USE_TZ = True
$ cat /etc/timezone
Asia/Yekaterinburg
$ ll /etc/localtime
/etc/localtime -> /usr/share/zoneinfo/Asia/Yekaterinburg
File "/home/user/myproject/apps/core/dev.py", line 22, in fill_dev_db
list(Offer.objects.all())
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/models/query.py", line 256, in __iter__
self._fetch_all()
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/models/query.py", line 1087, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/models/query.py", line 65, in __iter__
for row in compiler.results_iter(results):
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 792, in results_iter
for rows in results:
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1238, in cursor_iter
sentinel):
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1237, in <lambda>
for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/utils.py", line 101, in inner
return func(*args, **kwargs)
File "/home/user/myproject/python3/lib/python3.5/site-packages/django/db/backends/postgresql/utils.py", line 6, in utc_tzinfo_factory
raise AssertionError("database connection isn't set to UTC")
# django/db/backends/postgresql/utils.py
def utc_tzinfo_factory(offset):
if offset != 0:
raise AssertionError("database connection isn't set to UTC")
return utc
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question