title: Django 4 Error: 'No time zone found with key ...'
body: <p>After rebuild of my Django 4 Docker container the web service stopped working with this error:</p>
  <blockquote>
  <p>zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key
  Asia/Hanoi'</p>
  </blockquote>
  <p>My setup is:</p>
  <ul>
  <li>Python 3.10</li>
  <li>Django 4.0.5</li>
  </ul>
  <p>Error:</p>
  <pre class="lang-none prettyprint-override"><code>web_1              
  Traceback (most recent call last): web_1          
    File &quot;/usr/local/lib/python3.10/zoneinfo/_common.py&quot;, line 12, in load_tzdata web_1              
      return importlib.resources.open_binary(package_name, resource_name) web_1     
    File &quot;/usr/local/lib/python3.10/importlib/resources.py&quot;, line 46, in open_binary web_1              
      return reader.open_resource(resource) web_1              
    File &quot;/usr/local/lib/python3.10/importlib/abc.py&quot;, line 433, in open_resource web_1              
      return self.files().joinpath(resource).open('rb') web_1              
    File &quot;/usr/local/lib/python3.10/pathlib.py&quot;, line 1119, in open web_1       
      return self._accessor.open(self, mode, buffering, encoding, errors, web_1              
  FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/site-packages/tzdata/zoneinfo/Asia/Hanoi' web_1              
   web_1              
  During handling of the above exception, another exception occurred: web_1              
   web_1              
  Traceback (most recent call last): web_1          
    File &quot;/home/app/web/manage.py&quot;, line 22, in &lt;module&gt; web_1         
      main() web_1              
    File &quot;/home/app/web/manage.py&quot;, line 18, in main web_1              
      execute_from_command_line(sys.argv) web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py&quot;, line 446, in execute_from_command_line web_1              
      utility.execute() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py&quot;, line 420, in execute web_1              
      django.setup() web_1     
    File &quot;/usr/local/lib/python3.10/site-packages/django/__init__.py&quot;, line 24, in setup web_1              
      apps.populate(settings.INSTALLED_APPS) web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/apps/registry.py&quot;, line 116, in populate web_1              
      app_config.import_models() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/apps/config.py&quot;, line 304, in import_models web_1              
      self.models_module = import_module(models_module_name) web_1              
    File &quot;/usr/local/lib/python3.10/importlib/__init__.py&quot;, line 126, in import_module web_1              
      return _bootstrap._gcd_import(name[level:], package, level) web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked web_1    
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked web_1              
    File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 883, in exec_module web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed web_1   
    File &quot;/usr/local/lib/python3.10/site-packages/django_celery_beat/models.py&quot;, line 8, in &lt;module&gt; web_1              
      import timezone_field web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/__init__.py&quot;, line 1, in &lt;module&gt; web_1              
      from timezone_field.fields import TimeZoneField web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/fields.py&quot;, line 11, in &lt;module&gt; web_1              
      class TimeZoneField(models.Field): web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/fields.py&quot;, line 41, in TimeZoneField web_1              
      default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones] web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/fields.py&quot;, line 41, in &lt;listcomp&gt; web_1              
      default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones] web_1              
    File &quot;/usr/local/lib/python3.10/zoneinfo/_common.py&quot;, line 24, in load_tzdata web_1              
      raise ZoneInfoNotFoundError(f&quot;No time zone found with key {key}&quot;) web_1              
  zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Asia/Hanoi' web_1              
  [2022-08-12 09:18:36 +0000] [1] [INFO] Starting gunicorn 20.0.4 web_1              
  [2022-08-12 09:18:36 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1) web_1 
  [2022-08-12 09:18:36 +0000] [1] [INFO] Using worker: sync web_1      
  [2022-08-12 09:18:36 +0000] [11] [INFO] Booting worker with pid: 11 web_1              
  [2022-08-12 12:18:37 +0300] [11] [ERROR] Exception in worker process web_1              
  Traceback (most recent call last): web_1              
    File &quot;/usr/local/lib/python3.10/zoneinfo/_common.py&quot;, line 12, in load_tzdata web_1              
      return importlib.resources.open_binary(package_name, resource_name) web_1     
    File &quot;/usr/local/lib/python3.10/importlib/resources.py&quot;, line 46, in open_binary web_1              
      return reader.open_resource(resource) web_1              
    File &quot;/usr/local/lib/python3.10/importlib/abc.py&quot;, line 433, in open_resource web_1              
      return self.files().joinpath(resource).open('rb') web_1              
    File &quot;/usr/local/lib/python3.10/pathlib.py&quot;, line 1119, in open web_1       
      return self._accessor.open(self, mode, buffering, encoding, errors, web_1              
  FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/site-packages/tzdata/zoneinfo/Asia/Hanoi' web_1              
   web_1              
  During handling of the above exception, another exception occurred: web_1              
   web_1              
  Traceback (most recent call last): web_1          
    File &quot;/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py&quot;, line 583, in spawn_worker web_1              
      worker.init_process() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py&quot;, line 119, in init_process web_1              
      self.load_wsgi() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py&quot;, line 144, in load_wsgi web_1              
      self.wsgi = self.app.wsgi() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py&quot;, line 67, in wsgi web_1              
      self.callable = self.load() web_1 
    File &quot;/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py&quot;, line 49, in load web_1              
      return self.load_wsgiapp() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py&quot;, line 39, in load_wsgiapp web_1              
      return util.import_app(self.app_uri) web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/gunicorn/util.py&quot;, line 358, in import_app web_1              
      mod = importlib.import_module(module) web_1              
    File &quot;/usr/local/lib/python3.10/importlib/__init__.py&quot;, line 126, in import_module web_1              
      return _bootstrap._gcd_import(name[level:], package, level) web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked web_1    
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked web_1              
    File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 883, in exec_module web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed web_1   
    File &quot;/home/app/web/config/wsgi.py&quot;, line 16, in &lt;module&gt; web_1    
      application = get_wsgi_application() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/core/wsgi.py&quot;, line 12, in get_wsgi_application web_1              
      django.setup(set_prefix=False) web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/__init__.py&quot;, line 24, in setup web_1              
      apps.populate(settings.INSTALLED_APPS) web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/apps/registry.py&quot;, line 116, in populate web_1              
      app_config.import_models() web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/django/apps/config.py&quot;, line 304, in import_models web_1              
      self.models_module = import_module(models_module_name) web_1              
    File &quot;/usr/local/lib/python3.10/importlib/__init__.py&quot;, line 126, in import_module web_1              
      return _bootstrap._gcd_import(name[level:], package, level) web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked web_1    
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked web_1              
    File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 883, in exec_module web_1              
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed web_1   
    File &quot;/usr/local/lib/python3.10/site-packages/django_celery_beat/models.py&quot;, line 8, in &lt;module&gt; web_1              
      import timezone_field web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/__init__.py&quot;, line 1, in &lt;module&gt; web_1              
      from timezone_field.fields import TimeZoneField web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/fields.py&quot;, line 11, in &lt;module&gt; web_1              
      class TimeZoneField(models.Field): web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/fields.py&quot;, line 41, in TimeZoneField web_1              
      default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones] web_1              
    File &quot;/usr/local/lib/python3.10/site-packages/timezone_field/fields.py&quot;, line 41, in &lt;listcomp&gt; web_1              
      default_zoneinfo_tzs = [ZoneInfo(tz) for tz in pytz.common_timezones] web_1              
    File &quot;/usr/local/lib/python3.10/zoneinfo/_common.py&quot;, line 24, in load_tzdata web_1              
      raise ZoneInfoNotFoundError(f&quot;No time zone found with key {key}&quot;) web_1              
  zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Asia/Hanoi' web_1              
  [2022-08-12 12:18:37 +0300] [11] [INFO] Worker exiting (pid: 11) web_1              
  [2022-08-12 09:18:37 +0000] [1] [INFO] Shutting down: Master web_1              
  [2022-08-12 09:18:37 +0000] [1] [INFO] Reason: Worker failed to boot.
  </code></pre>
  <p>In the Django settings file:</p>
  <pre><code>TIME_ZONE = 'UTC'
  USE_TZ = True
  </code></pre>
  <p>PS: As suggested in another post I added <code>tzdata</code> to my requirements file but nothing changed.</p>