[Fixed]-Django 4 Error: 'No time zone found with key …'

16👍

Downgrading the pytz version from 2022.2 to 2022.1 seems to have solved this issue for me.

12👍

I’ve got the same error. It helps me to fix it:

# upgrade pytz up to the latest pytz-2022.2.1
pip install pytz --upgrade
# upgarde tzdata up to tzdata-2022.2
pip install tzdata --upgrade

After upgrades pytz and tzdata my Django project is working just fine again!

5👍

As a quick (and dirty) way to fix this add these lines to your Dockerfile:

RUN cp /usr/local/lib/python3.10/site-packages/tzdata/zoneinfo/Asia/Aden /usr/local/lib/python3.10/site-packages/tzdata/zoneinfo/Asia/Hanoi && \
cp /usr/local/lib/python3.10/site-packages/tzdata/zoneinfo/Europe/Moscow /usr/local/lib/python3.10/site-packages/tzdata/zoneinfo/Europe/Kyiv
👤DrRos

2👍

thanks for https://stackoverflow.com/a/73365642/1099058, it’s solve my problem.

  1. make tzdata and pytz package to latest version:
   pip uninstall pytz
   pip install pytz==2022.2.1
   pip uninstall tzdata
   pip install tzdata==2022.2
  1. test django in 4.0.5 and 4.1 will working:
    my enviroments

0👍

The old and incorrect name Kiev was renamed to correct Kyiv. In this case not all packages were updated and there are some conflicts. It will be fixed over time, but for now you can just use a symlink to support both version just running a command in your Linux

ln -s /usr/share/zoneinfo/Europe/Kiev /usr/share/zoneinfo/Europe/Kyiv

Leave a comment