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
pythonee
V2EX  ›  Python

django 怎么使用多种语言,前台使用 en_US,而 admin 使用 zh_CN

  •  
  •   pythonee · 2015-06-11 14:51:03 +08:00 · 2040 次点击
    这是一个创建于 3262 天前的主题,其中的信息可能已经有所发展或是发生改变。
    settings.py里面可以只指定一种语言,我怎么能在admin的时候使用另外一种语言呢
    5 条回复    2015-06-12 11:19:53 +08:00
    lyhapple
        1
    lyhapple  
       2015-06-11 15:33:07 +08:00
    改源码去吧
    realityone
        2
    realityone  
       2015-06-11 17:54:08 +08:00
    glasslion
        3
    glasslion  
       2015-06-11 18:06:48 +08:00
    写个 Middleware, 对 前台 的 request ,把 Accept-Language 头设成英文,
    recall704
        4
    recall704  
       2015-06-12 10:37:41 +08:00
    可以用cookie 來实现
    pythonee
        5
    pythonee  
    OP
       2015-06-12 11:19:53 +08:00
    @glasslion
    @recall704

    中间件这个方式应该可以
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5602 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 01:31 · PVG 09:31 · LAX 18:31 · JFK 21:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.