问题描述
限时送ChatGPT账号..我正在关注 Django 官方文档,以使用 Django 编写我的第一个应用程序.
I am following the Django official documentation for writing my first app using Django.
这里,它说我必须在 settings.py
文件中将 TIME_ZONE
设置为我的时区.
Here, it says that I have to set TIME_ZONE
to my time zone in the settings.py
file.
TIME_ZONE
的默认值是 "utc"
,我已经将其更改为 "utc+6.00"
.
The default value of TIME_ZONE
was "utc"
and i have changed it to "utc+6.00"
.
在此编辑之后,当我尝试迁移 manage.py
文件时:
After this edit, when I try to migrate the manage.py
file:
python manage.py migrate
发生值错误:
ValueError:时区设置不正确:UTC+6.00
ValueError: Incorrect timezone setting: UTC+6.00
很抱歉,如果这是一个非常基本的问题,但我在谷歌搜索了几个小时后找不到解决方案.
I am sorry, if this is a very basic question, but I couldn't figure out the solution after hours of search in Google.
注意:
我的时区是亚洲/达卡 (+6:00)
My time zone is Asia/Dhaka (+6:00)
我的操作系统是 Ubuntu 14.10
My OS is Ubuntu 14.10
推荐答案
根据 文档:
TIME_ZONE
默认:'美国/芝加哥'
Default: 'America/Chicago'
表示此安装时区的字符串,或无.
A string representing the time zone for this installation, or None.
将 TIME_ZONE
设置为 Asia/Dhaka
,而不是 utc+6.00
:
Instead of utc+6.00
, set the TIME_ZONE
to Asia/Dhaka
:
TIME_ZONE = 'Asia/Dhaka'
这篇关于ValueError:在 Django 中迁移 manage.py 文件时不正确的时区设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论