zoukankan      html  css  js  c++  java
  • Django1-10-5管理界面中文设置

    先确定一下版本是否更高,低版本设置(settings.py文件):

    LANGUAGE_CODE = 'zh-CN'

    TIME_ZONE = 'Asia/Shanghai'

    但是新版本就会提示不识别zh-CN,网上查了一下会让你添加 'django.middleware.locale.LocaleMiddleware'到settings.py文件中的MIDDLEWARE中,并且还要放在'django.contrib.sessions.middleware.SessionMiddleware'之后,

    然后语言类型设置:

    LANGUAGE_CODE = 'zh-Hans'

    TIME_ZONE = 'Asia/Shanghai'

    登陆发现没错,但是显示的还是英文,

    然后我把那句注释掉,如下:

    MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    #'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

    ]


    刷新就可以显示中文了!(具体实现望高手评论)
    MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    #'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

    ]
  • 相关阅读:
    1292
    explicit_defaults_for_timestamp
    比较好的平台工具
    git回退到指定版本的代码
    解决catalina.out文件过大的方法
    json字符串转化成对象列表数据
    Java LIST做批量分组切割
    Activiti数据库表结构
    MySQL修改数据库时区
    集合工具类的使用
  • 原文地址:https://www.cnblogs.com/Nithumahel/p/6534909.html
Copyright © 2011-2022 走看看