V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
flingjie
V2EX  ›  Django

django 运行正常, gunicorn 运行报'ascii' codec can't encode…错误

  •  1
     
  •   flingjie ·
    flingjie · 2016-01-05 18:59:31 +08:00 · 3750 次点击
    这是一个创建于 3033 天前的主题,其中的信息可能已经有所发展或是发生改变。

    定位到是 gunicorn 的编码问题, 经查找可以为 gunicorn 添加环境变量,在 /etc/supervisor/supervisord.conf 添加:

    environment=LANG=zh_CN.UTF-8,LC_ALL=zh_CN.UTF-8

    然后需要重启 supervisord, 搞定,下班

    2 条回复    2016-01-06 10:39:44 +08:00
    latyas
        1
    latyas  
       2016-01-06 04:02:41 +08:00
    是不是 print 了中文 23333
    flingjie
        2
    flingjie  
    OP
       2016-01-06 10:39:44 +08:00
    @latyas 哈哈, 不是啊, 是数据库中有中文的内容
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3580 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 11:03 · PVG 19:03 · LAX 04:03 · JFK 07:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.