How to set the timezone in Django? How to set the timezone in Django? python python

How to set the timezone in Django?


Here is the list of valid timezones:

http://en.wikipedia.org/wiki/List_of_tz_database_time_zones

You can use

TIME_ZONE = 'Europe/Istanbul'

for UTC+02:00


To get a set of all valid timezone names (ids) from the tz database, you could use pytz module in Python:

>>> import pytz # $ pip install pytz>>> pytz.all_timezones_setLazySet({'Africa/Abidjan',         'Africa/Accra',         'Africa/Addis_Ababa',         'Africa/Algiers',         'Africa/Asmara',         'Africa/Asmera',         ...         'UTC',         'Universal',         'W-SU',         'WET',         'Zulu'})


Choose a valid timezone from the tzinfo database. They tend to take the form e.g. Africa/Gaborne and US/Eastern

Find the one which matches the city nearest you, or the one which has your timezone, then set your value of TIME_ZONE to match.