AssertionError: database connection isn't set to UTC

1,302 views
Skip to first unread message

Lars Olafsson

unread,
Sep 11, 2016, 10:59:56 AM9/11/16
to Django users
Dear Reader, 

I hope someone here can help me, resolve this issue.

I have installed a new server and even though i have the same exact setup running, and I have even cloned the database from my other server. I get this error when i try to connect to Django on the web. And I cannot figure out why. 

Internal Server Error: /teams/
Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/lib64/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib64/python3.4/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/var/www/djc/TeamTournament/teamTournamentApp/views.py", line 167, in get
    return HttpResponseRedirect(reverse('teamTournamentApp:team_tournament',args=(Tournament.objects.latest('start_date').id,)))
  File "/usr/lib64/python3.4/site-packages/django/db/models/manager.py", line 122, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/django/db/models/query.py", line 544, in latest
    return self._earliest_or_latest(field_name=field_name, direction="-")
  File "/usr/lib64/python3.4/site-packages/django/db/models/query.py", line 538, in _earliest_or_latest
    return obj.get()
  File "/usr/lib64/python3.4/site-packages/django/db/models/query.py", line 381, in get
    num = len(clone)
  File "/usr/lib64/python3.4/site-packages/django/db/models/query.py", line 240, in __len__
    self._fetch_all()
  File "/usr/lib64/python3.4/site-packages/django/db/models/query.py", line 1074, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/usr/lib64/python3.4/site-packages/django/db/models/query.py", line 68, in __iter__
    for row in compiler.results_iter(results):
  File "/usr/lib64/python3.4/site-packages/django/db/models/sql/compiler.py", line 805, in results_iter
    for rows in results:
  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

I am running Django 1.9.2. 


I hope someone can help me?

I do not believe the error is actually what the problem is, there most be something else in the setup which is incorrect. 

Lars Olafsson

unread,
Sep 11, 2016, 12:47:32 PM9/11/16
to Django users
it would be great if someone could explain to me, where the offset in the function utc_tzinfo_factory comes from. My python skills apparently are not sufficient to be able to trace this in the code.

/Lars
Reply all
Reply to author
Forward
0 new messages