10👍
Instead of ‘UTC’ use ‘zone/city’, e.g. TIME_ZONE = 'Europe/Moscow'
A list of possible values can be obtained like this:
import zoneinfo
zoneinfo.available_timezones()
👤Dr3d
- [Django]-How do you limit list objects template side, rather than view side
- [Django]-OperationalError: database is locked
- [Django]-Django F() division – How to avoid rounding off
- [Django]-Django admin, hide a model
- [Django]-CSRF Token missing or incorrect
- [Django]-Optimal architecture for multitenant application on django
0👍
I got the same error below:
zoneinfo._common.ZoneInfoNotFoundError: ‘No time zone found with key America/NewYork’
Because I set 'America/NewYork'
to TIME_ZONE as shown below:
# "settings.py"
TIME_ZONE = 'America/NewYork'
So, I set 'America/New_York'
to TIME_ZONE
as shown below, then the error was solved:
# "settings.py"
# ↓ "_" is added
TIME_ZONE = 'America/New_York'
- [Django]-0 value in Django PositiveIntegerField?
- [Django]-How can I make a Django form field contain only alphanumeric characters
- [Django]-How do you limit list objects template side, rather than view side
-1👍
my python’s version is 3.11 and Django’s version is 4.2.1
I got the same error before:
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key UTC+8'
I tried other methods from this page, such as pip install tzdata
or pip install pytz
, but none of them worked .
finally, I changed the value of TIME_ZONE from ‘UTC+8’ to ‘Asia/ShangHai’, and then the error disappeared!
before:
#settings.py
TIME_ZONE = 'UTC+8'
after:
#settings.py
TIME_ZONE = 'Asia/ShangHai'
👤KLW
- [Django]-Django static page?
- [Django]-How to customize user profile when using django-allauth
- [Django]-Ordering a Django queryset by the returned results of a method
- [Django]-Testing Django apps that use South migrations
- [Django]-Django 1.8: Create initial migrations for existing schema
- [Django]-Django admin: override delete method
Source:stackexchange.com