V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
flyingkid
V2EX  ›  Python

admin设置没编程中文,也不知道错在那里,谁能帮我看看

  •  
  •   flyingkid ·
    kennx · 2011 年 10 月 26 日 · 4186 次点击
    这是一个创建于 5210 天前的主题,其中的信息可能已经有所发展或是发生改变。
    13 条回复    1970-01-01 08:00:00 +08:00
    chenluois
        1
    chenluois  
       2011 年 10 月 26 日
    重启Apache了没?
    flyingkid
        2
    flyingkid  
    OP
       2011 年 10 月 26 日
    python manage.py runserver 8000

    没装apache呀
    chenluois
        3
    chenluois  
       2011 年 10 月 26 日
    全小写试试看,把
    LANGUAGE_CODE = 'zh-CN'
    改成
    LANGUAGE_CODE = 'zh-cn'
    bhuztez
        4
    bhuztez  
       2011 年 10 月 26 日
    zh_CN
    flyingkid
        5
    flyingkid  
    OP
       2011 年 10 月 26 日
    @chenluois @bhuztez

    无用。 0.0
    算了我放弃了。这点英文不算什么。回头在研究。
    chenluois
        6
    chenluois  
       2011 年 10 月 26 日
    @flyingkid 我还是怀疑你没有重启。在服务器上就重启Apache,本地就再运行一下runserver。

    改成小写后
    LANGUAGE_CODE = 'zh-cn'
    再运行一下
    python manage.py runserver 8000
    清除缓存,刷新浏览器
    keakon
        7
    keakon  
       2011 年 10 月 26 日
    @flyingkid 貌似LocaleMiddleware先根据浏览器发出的cookie和Accept-Language来判断,找不到合适的才使用LANGUAGE_CODE
    flyingkid
        8
    flyingkid  
    OP
       2011 年 10 月 26 日
    @chenluois @keakon
    果然是这样呀。。我到。
    thx
    chenluois
        9
    chenluois  
       2011 年 10 月 26 日
    @flyingkid You're welcome.
    flyingkid
        10
    flyingkid  
    OP
       2011 年 10 月 26 日
    @chenluois
    我又回来。哈哈。
    不过又发现自定义字段无法中文。= =。
    http://gist.github.com/1315876
    chenluois
        11
    chenluois  
       2011 年 10 月 26 日
    @flyingkid 设置文件编码了没?UTF-8。
    flyingkid
        12
    flyingkid  
    OP
       2011 年 10 月 27 日
    @chenluois 我设置了model.py这个文件的编码是utf-8。难道还要做其他处理?
    flyingkid
        13
    flyingkid  
    OP
       2011 年 10 月 27 日
    @chenluois

    thx。我知道怎么弄了。哈哈。原来需要在顶部加上
    # -*- coding: utf-8 -*-
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2164 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 14:23 · PVG 22:23 · LAX 06:23 · JFK 09:23
    ♥ Do have faith in what you're doing.