Django 1.11的时区设置和原来的不同了:
文件:setting.py
LANGUAGE_CODE = ‘zh-CN‘ TIME_ZONE = ‘Asia/Shanghai‘ USE_I18N = True USE_L10N = True USE_TZ = True
原来这么写,没问题,但是1.11不可以这么写!否则服务器就要报错哦!正确写法是:
LANGUAGE_CODE = ‘zh-Hans‘ TIME_ZONE = ‘Asia/Shanghai‘ USE_I18N = True USE_L10N = True USE_TZ = True
看到变化了吗?下面贴一下django源码里关于LANGUAGE_CODE的最新定义,按新的写!
LANGUAGES = [ (‘af‘, gettext_noop(‘Afrikaans‘)), (‘ar‘, gettext_noop(‘Arabic‘)), (‘ast‘, gettext_noop(‘Asturian‘)), (‘az‘, gettext_noop(‘Azerbaijani‘)), (‘bg‘, gettext_noop(‘Bulgarian‘)), (‘be‘, gettext_noop(‘Belarusian‘)), (‘bn‘, gettext_noop(‘Bengali‘)), (‘br‘, gettext_noop(‘Breton‘)), (‘bs‘, gettext_noop(‘Bosnian‘)), (‘ca‘, gettext_noop(‘Catalan‘)), (‘cs‘, gettext_noop(‘Czech‘)), (‘cy‘, gettext_noop(‘Welsh‘)), (‘da‘, gettext_noop(‘Danish‘)), (‘de‘, gettext_noop(‘German‘)), (‘dsb‘, gettext_noop(‘Lower Sorbian‘)), (‘el‘, gettext_noop(‘Greek‘)), (‘en‘, gettext_noop(‘English‘)), (‘en-au‘, gettext_noop(‘Australian English‘)), (‘en-gb‘, gettext_noop(‘British English‘)), (‘eo‘, gettext_noop(‘Esperanto‘)), (‘es‘, gettext_noop(‘Spanish‘)), (‘es-ar‘, gettext_noop(‘Argentinian Spanish‘)), (‘es-co‘, gettext_noop(‘Colombian Spanish‘)), (‘es-mx‘, gettext_noop(‘Mexican Spanish‘)), (‘es-ni‘, gettext_noop(‘Nicaraguan Spanish‘)), (‘es-ve‘, gettext_noop(‘Venezuelan Spanish‘)), (‘et‘, gettext_noop(‘Estonian‘)), (‘eu‘, gettext_noop(‘Basque‘)), (‘fa‘, gettext_noop(‘Persian‘)), (‘fi‘, gettext_noop(‘Finnish‘)), (‘fr‘, gettext_noop(‘French‘)), (‘fy‘, gettext_noop(‘Frisian‘)), (‘ga‘, gettext_noop(‘Irish‘)), (‘gd‘, gettext_noop(‘Scottish Gaelic‘)), (‘gl‘, gettext_noop(‘Galician‘)), (‘he‘, gettext_noop(‘Hebrew‘)), (‘hi‘, gettext_noop(‘Hindi‘)), (‘hr‘, gettext_noop(‘Croatian‘)), (‘hsb‘, gettext_noop(‘Upper Sorbian‘)), (‘hu‘, gettext_noop(‘Hungarian‘)), (‘ia‘, gettext_noop(‘Interlingua‘)), (‘id‘, gettext_noop(‘Indonesian‘)), (‘io‘, gettext_noop(‘Ido‘)), (‘is‘, gettext_noop(‘Icelandic‘)), (‘it‘, gettext_noop(‘Italian‘)), (‘ja‘, gettext_noop(‘Japanese‘)), (‘ka‘, gettext_noop(‘Georgian‘)), (‘kk‘, gettext_noop(‘Kazakh‘)), (‘km‘, gettext_noop(‘Khmer‘)), (‘kn‘, gettext_noop(‘Kannada‘)), (‘ko‘, gettext_noop(‘Korean‘)), (‘lb‘, gettext_noop(‘Luxembourgish‘)), (‘lt‘, gettext_noop(‘Lithuanian‘)), (‘lv‘, gettext_noop(‘Latvian‘)), (‘mk‘, gettext_noop(‘Macedonian‘)), (‘ml‘, gettext_noop(‘Malayalam‘)), (‘mn‘, gettext_noop(‘Mongolian‘)), (‘mr‘, gettext_noop(‘Marathi‘)), (‘my‘, gettext_noop(‘Burmese‘)), (‘nb‘, gettext_noop(‘Norwegian Bokm?l‘)), (‘ne‘, gettext_noop(‘Nepali‘)), (‘nl‘, gettext_noop(‘Dutch‘)), (‘nn‘, gettext_noop(‘Norwegian Nynorsk‘)), (‘os‘, gettext_noop(‘Ossetic‘)), (‘pa‘, gettext_noop(‘Punjabi‘)), (‘pl‘, gettext_noop(‘Polish‘)), (‘pt‘, gettext_noop(‘Portuguese‘)), (‘pt-br‘, gettext_noop(‘Brazilian Portuguese‘)), (‘ro‘, gettext_noop(‘Romanian‘)), (‘ru‘, gettext_noop(‘Russian‘)), (‘sk‘, gettext_noop(‘Slovak‘)), (‘sl‘, gettext_noop(‘Slovenian‘)), (‘sq‘, gettext_noop(‘Albanian‘)), (‘sr‘, gettext_noop(‘Serbian‘)), (‘sr-latn‘, gettext_noop(‘Serbian Latin‘)), (‘sv‘, gettext_noop(‘Swedish‘)), (‘sw‘, gettext_noop(‘Swahili‘)), (‘ta‘, gettext_noop(‘Tamil‘)), (‘te‘, gettext_noop(‘Telugu‘)), (‘th‘, gettext_noop(‘Thai‘)), (‘tr‘, gettext_noop(‘Turkish‘)), (‘tt‘, gettext_noop(‘Tatar‘)), (‘udm‘, gettext_noop(‘Udmurt‘)), (‘uk‘, gettext_noop(‘Ukrainian‘)), (‘ur‘, gettext_noop(‘Urdu‘)), (‘vi‘, gettext_noop(‘Vietnamese‘)), (‘zh-hans‘, gettext_noop(‘Simplified Chinese‘)), (‘zh-hant‘, gettext_noop(‘Traditional Chinese‘)), ]
时间: 2024-10-05 00:23:30