From c7a6996df7e77bc3b9c5e581e67d766627ebabec Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Tue, 10 Feb 2015 21:37:53 +0100 Subject: [PATCH] Fixed a crash of the debug page. During the autumn DST change, the template engine would fail to convert the naive representation of now when USE_TZ = True. Passing now in UTC eliminates the issue. Thanks mbertheau and tricoder42. Refs #23714. --- django/views/debug.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/django/views/debug.py b/django/views/debug.py index 0a4aa8f74d..80b0e38eb1 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import datetime import os import re import sys @@ -13,7 +12,7 @@ from django.http import ( ) from django.template import Context, Engine, TemplateDoesNotExist from django.template.defaultfilters import force_escape, pprint -from django.utils import lru_cache, six +from django.utils import lru_cache, six, timezone from django.utils.datastructures import MultiValueDict from django.utils.encoding import force_bytes, smart_text from django.utils.html import escape @@ -362,7 +361,7 @@ class ExceptionReporter(object): 'settings': get_safe_settings(), 'sys_executable': sys.executable, 'sys_version_info': '%d.%d.%d' % sys.version_info[0:3], - 'server_time': datetime.datetime.now(), + 'server_time': timezone.now(), 'django_version_info': get_version(), 'sys_path': sys.path, 'template_info': self.template_info,