[Django] #33674: Timezones cause 500 errors to not email the site admin

56 views
Skip to first unread message

Django

unread,
May 2, 2022, 7:28:22 PM5/2/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
-------------------------------------------+------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
I believe I have found a bug - my site was working great prior to adding
support for localization/timezones and if a user encountered a 500
internal server error, I'd get an email about it and could fix it. I
added support for timezones, and **stopped getting the alert emails** --
and the users are no longer sent to my 500 page.

Here's some information:
* debug=True causes things to work correctly (no email sent, debug info
displayed to the user)
* this does not happen in a development environment at all as far as I can
tell
* I am using Channels and Daphne to serve content behind an Nginx reverse
proxy
* When 500 errors happen, the user gets redirected to a very generic
Daphne "exception inside application" page. Before you blame this on
Daphne, please keep reading...
* The error log traceback points to `site-
packages/django/templatetags/tz.py`

If I change this class to look as follows:
{{{
def render(self, context):
try:
with timezone.override(self.tz.resolve(context)):
output = self.nodelist.render(context)
return output
except:
return self.nodelist.render(context)
}}}
the correct 500 error page is rendered and the email goes out to me
telling me where the error occurred. That suggests to me that something
in timezone.override isn't working as it should be.

I could just make a PR with this but I am not really sure what
consequences this change has.

I know there's a lack of info in this, and I apologize in advance. Because
I only see this issue on my production server, I have to take my whole
site down to try to test and troubleshoot it.

--
Ticket URL: <https://code.djangoproject.com/ticket/33674>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 2, 2022, 7:31:47 PM5/2/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------

Reporter: iragm | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: 4.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by iragm:

Old description:

New description:

I believe I have found a bug - my site was working great prior to adding
support for localization/timezones and if a user encountered a 500
internal server error, I'd get an email about it and could fix it. I
added support for timezones, and **stopped getting the alert emails** --
and the users are no longer sent to my 500 page.

Here's some information:
* debug=True causes things to work correctly (no email sent, debug info
displayed to the user)
* this does not happen in a development environment at all as far as I can
tell
* I am using Channels and Daphne to serve content behind an Nginx reverse
proxy

* Edit: using python3 manage.py runserver with debug=False returns the
correct 500 page. This issue is only happening when running with Daphne.


* When 500 errors happen, the user gets redirected to a very generic
Daphne "exception inside application" page. Before you blame this on
Daphne, please keep reading...
* The error log traceback points to `site-
packages/django/templatetags/tz.py`

If I change this class to look as follows:
{{{
def render(self, context):
try:
with timezone.override(self.tz.resolve(context)):
output = self.nodelist.render(context)
return output
except:
return self.nodelist.render(context)
}}}
the correct 500 error page is rendered and the email goes out to me
telling me where the error occurred. That suggests to me that something
in timezone.override isn't working as it should be.

I could just make a PR with this but I am not really sure what
consequences this change has.

I know there's a lack of info in this, and I apologize in advance. Because
I only see this issue on my production server, I have to take my whole
site down to try to test and troubleshoot it.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:1>

Django

unread,
May 3, 2022, 3:02:35 AM5/3/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: closed

Component: Error reporting | Version: 4.0
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => needsinfo


Comment:

Hi, thanks for the report.

Can I ask you to flesh it out?

> The error log traceback points to site-
packages/django/templatetags/tz.py

Can you provide the traceback here please? (Specifically, we need to see
what the exception is that you're catching with the added `except`
there...)

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:2>

Django

unread,
May 3, 2022, 6:55:06 AM5/3/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 4.0
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by iragm):

{{{
2022-05-03 06:47:54,594 ERROR Exception inside application: 'No time
zone found with key '
Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/base.py", line 253, in _get_response_async
response = await wrapped_callback(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/opt/production/lib/python3.9/site-
packages/asgiref/current_thread_executor.py", line 22, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
455, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/generic/base.py", line 84, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/production/fishauctions/./auctions/views.py", line 2242, in
dispatch
raise DeliberateError("break stuff")
NameError: name 'DeliberateError' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/deprecation.py", line 150, in __acall__
response = response or await self.get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/deprecation.py", line 150, in __acall__
response = response or await self.get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/deprecation.py", line 150, in __acall__
response = response or await self.get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/deprecation.py", line 150, in __acall__
response = response or await self.get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/deprecation.py", line 150, in __acall__
response = response or await self.get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/deprecation.py", line 150, in __acall__
response = response or await self.get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/deprecation.py", line 150, in __acall__
response = response or await self.get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/opt/production/lib/python3.9/site-
packages/debug_toolbar/middleware.py", line 48, in __call__
return self.get_response(request)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
204, in __call__
return call_result.result()
File "/usr/lib/python3.9/concurrent/futures/_base.py", line 438, in
result
return self.__get_result()
File "/usr/lib/python3.9/concurrent/futures/_base.py", line 390, in
__get_result
raise self._exception
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
270, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 44, in inner
response = await sync_to_async(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
453, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.9/zoneinfo/_common.py", line 12, in load_tzdata
return importlib.resources.open_binary(package_name, resource_name)
File "/usr/lib/python3.9/importlib/resources.py", line 88, in
open_binary
package = _get_package(package)
File "/usr/lib/python3.9/importlib/resources.py", line 49, in
_get_package
module = _resolve(package)
File "/usr/lib/python3.9/importlib/resources.py", line 40, in _resolve
return import_module(name)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in
_call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in
_find_and_load_unlocked
ModuleNotFoundError: No module named 'tzdata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-packages/channels/routing.py",
line 71, in __call__
return await application(scope, receive, send)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/asgi.py", line 155, in __call__
await self.handle(scope, receive, send)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/asgi.py", line 177, in handle
response = await self.get_response_async(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/base.py", line 162, in get_response_async
response = await self._middleware_chain(request)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
455, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 57, in inner
response = response_for_exception(request, exc)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 139, in
response_for_exception
response = handle_uncaught_exception(
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 184, in
handle_uncaught_exception
return callback(request)
File "/opt/production/lib/python3.9/site-
packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/defaults.py", line 102, in server_error
return HttpResponseServerError(template.render())
File "/opt/production/lib/python3.9/site-
packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 175, in render
return self._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/opt/production/lib/python3.9/site-packages/django/test/utils.py",
line 111, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 1000, in <listcomp>
return SafeString("".join([node.render_annotated(context) for node in
self]))
File "/opt/production/lib/python3.9/site-
packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/opt/production/lib/python3.9/site-
packages/django/templatetags/tz.py", line 146, in render
with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)
File "/usr/lib/python3.9/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key '

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:3>

Django

unread,
May 3, 2022, 8:21:57 AM5/3/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 4.0
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Carlton Gibson):

Thanks.

> ModuleNotFoundError: No module named 'tzdata'

Can you try `pip install tzdata` please?

(What's your platform info please? And what timezone are you trying to
set? 🤔)

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:4>

Django

unread,
May 4, 2022, 8:41:59 AM5/4/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 4.0
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by iragm):

tzinfo was not installed. I am not sure what to make of that, I would
have expected pip to install it. This is true both in my dev environment
which has always worked, and production, which only works when I add in
the try stuff:

Looks like we are now getting an error "Is a directory". I am going to
take a guess that NO timezone at all is being set by Daphne when an error
happens, which causes the path to go to the root folder rather than the
(for example) America folder and find the New_York file.

{{{
2022-05-04 08:19:20,317 ERROR Exception inside application: [Errno 21]
Is a directory: '/opt/production/lib/python3.9/site-
packages/tzdata/zoneinfo'


Traceback (most recent call last):
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/production/lib/python3.9/site-
packages/django/core/handlers/base.py", line 253, in _get_response_async
response = await wrapped_callback(
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
414, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
return await fut
File "/opt/production/lib/python3.9/site-
packages/asgiref/current_thread_executor.py", line 22, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/production/lib/python3.9/site-packages/asgiref/sync.py", line
455, in thread_handler
return func(*args, **kwargs)
File "/opt/production/lib/python3.9/site-
packages/django/views/generic/base.py", line 84, in view
return self.dispatch(request, *args, **kwargs)

File "/opt/production/fishauctions/./auctions/views.py", line 2245, in
dispatch
raise UnknownError()
NameError: name 'UnknownError' is not defined

packages/django/templatetags/tz.py", line 145, in render


with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)

File "/usr/lib/python3.9/zoneinfo/_common.py", line 12, in load_tzdata
return importlib.resources.open_binary(package_name, resource_name)

File "/usr/lib/python3.9/importlib/resources.py", line 91, in
open_binary
return reader.open_resource(resource)
File "<frozen importlib._bootstrap_external>", line 1055, in
open_resource
IsADirectoryError: [Errno 21] Is a directory:
'/opt/production/lib/python3.9/site-packages/tzdata/zoneinfo'

packages/django/templatetags/tz.py", line 145, in render


with timezone.override(self.tz.resolve(context)):
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 157, in __enter__
activate(self.timezone)
File "/opt/production/lib/python3.9/site-
packages/django/utils/timezone.py", line 121, in activate
_active.value = zoneinfo.ZoneInfo(timezone)

File "/usr/lib/python3.9/zoneinfo/_common.py", line 12, in load_tzdata
return importlib.resources.open_binary(package_name, resource_name)

File "/usr/lib/python3.9/importlib/resources.py", line 91, in
open_binary
return reader.open_resource(resource)
File "<frozen importlib._bootstrap_external>", line 1055, in
open_resource
IsADirectoryError: [Errno 21] Is a directory:
'/opt/production/lib/python3.9/site-packages/tzdata/zoneinfo'

During handling of the above exception, another exception occurred:

}}}


The time zone is supposed to be set via a cookie in my base.html file. My
settings look like this:
{{{
TIME_ZONE = os.environ['TIME_ZONE']
# this is set correctly to: 'America/New_York'

USE_I18N = False

USE_L10N = False

USE_TZ = True
}}}

At the top of base.html:
{{{
{% load tz %}
{% load l10n %}
{% timezone user_timezone %}
}}}

And user_timezone is set by a context processor:
{{{
def add_tz(request):
"""
Add timezone cookie - example: 'America/New_York'
This is set via js with
Intl.DateTimeFormat().resolvedOptions().timeZone
"""
user_timezone = ""
user_timezone_set = False
try:
if request.COOKIES['user_timezone']:
user_timezone = request.COOKIES['user_timezone']
user_timezone_set = True
except:
pass
if not user_timezone:
user_timezone = "America/Chicago"
user_timezone_set = False
return {'user_timezone': user_timezone, 'user_timezone_set':
user_timezone_set}
}}}

I believe this context processor is not getting called when the 500 error
occurs, so user_timezone is probably either None or an empty string. So
that could be the issue.

One of the things that I like about Django is that when I do something
stupid it tells me in the form of the error email - that should happen
even if the {% timezone user_timezone %} tag is not set correctly, right?

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:5>

Django

unread,
May 4, 2022, 10:15:57 AM5/4/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 4.0
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Carlton Gibson):

> tzinfo was not installed. I am not sure what to make of that, I would
have expected pip to install it.

You mean `tzdata`? — This is why I asked your OS, etc. It's ''quite
unexpected'' that your system would not have the timezone database
available, and installed in the expected locations. The `tzdata` package
is a fallback provided for such circumstances, which usually just means
Windows, for which it **is** installed automatically.

Can I ask you for a minimal reproduce projects. There's too much that
could be going on here: is it your system, is it Daphne, is it Django?
It's hard to diagnose a solution otherwise.

> ...that should happen even if the {% timezone user_timezone %} tag is
not set correctly, right?

As phrased, likely, yes, but how's it coming up? `IsADirectoryError` — if
this is a system error, it may be out-of-scope to try and work around.
(Not sure yet.)

Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:6>

Django

unread,
May 4, 2022, 10:25:00 AM5/4/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 4.0
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by iragm):

Yeah, sorry tzdata, not tzinfo. My system is an Ubuntu 21.10 desktop
system. At this point, it'll take me a couple days to set up another dev
environment and strip things down to a very simple case, so it's not worth
the time IMHO.

I'll just leave the try/except logic in my tz.py and keep hand editing it
each time I update.

Thanks for taking the time to reply, I really appreciate it.

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:7>

Django

unread,
May 4, 2022, 2:57:41 PM5/4/22
to django-...@googlegroups.com
#33674: Timezones cause 500 errors to not email the site admin
---------------------------------+--------------------------------------
Reporter: iragm | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 4.0
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Carlton Gibson):

OK, thanks. If you are able to put together a reproducer, that would be
good to see.

--
Ticket URL: <https://code.djangoproject.com/ticket/33674#comment:8>

Reply all
Reply to author
Forward
0 new messages