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 14:58:00 +08:00 · 3713 次点击
    这是一个创建于 4537 天前的主题,其中的信息可能已经有所发展或是发生改变。
    13 条回复    1970-01-01 08:00:00 +08:00
    chenluois
        1
    chenluois  
       2011-10-26 15:18:34 +08:00
    重启Apache了没?
    flyingkid
        2
    flyingkid  
    OP
       2011-10-26 15:30:46 +08:00
    python manage.py runserver 8000

    没装apache呀
    chenluois
        3
    chenluois  
       2011-10-26 15:49:10 +08:00
    全小写试试看,把
    LANGUAGE_CODE = 'zh-CN'
    改成
    LANGUAGE_CODE = 'zh-cn'
    bhuztez
        4
    bhuztez  
       2011-10-26 15:50:07 +08:00
    zh_CN
    flyingkid
        5
    flyingkid  
    OP
       2011-10-26 16:10:28 +08:00
    @chenluois @bhuztez

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

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

    thx。我知道怎么弄了。哈哈。原来需要在顶部加上
    # -*- coding: utf-8 -*-
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5112 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:41 · PVG 13:41 · LAX 22:41 · JFK 01:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.