How to set the timezone in Django?

后端 未结 8 894
萌比男神i
萌比男神i 2020-11-29 19:33

In my django project\'s settings.py file, I have this line :

TIME_ZONE = \'UTC\'

But I want my app to run in UTC+2 timezone, s

8条回答
  •  旧巷少年郎
    2020-11-29 20:15

    1. download latest pytz file (pytz-2019.3.tar.gz) from:

      https://pypi.org/simple/pytz/
      
    2. copy and extract it to site_packages directory on yor project

    3. in cmd go to the extracted folder and run:

      python setup.py install
      
    4. TIME_ZONE = 'Etc/GMT+2' or country name

提交回复
热议问题