【问题标题】:Django, nginx, gunicorn,supervisor: UnicodeEncodeError - when uploading non-latin named fileDjango,nginx,gunicorn,supervisor:UnicodeEncodeError - 上传非拉丁命名文件时
【发布时间】:2015-03-24 03:02:07
【问题描述】:

当我上传一些非拉丁名称的文件时出现错误:

UnicodeEncodeError at /profiles/
'ascii' codec can't encode characters in position 39-41: ordinal not in range(128)

我已尝试更改主管环境它是如何描述的 here,但它没有帮助。我在 /etc/supervisor/supervisord.conf 中添加了这一行:

[supervisord]
environment=LANG="ru_RU.utf8", LC_LANG="ru_RU.UTF-8", LC_ALL="ru_RU.UTF-8"
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

当我将此行放入程序特定的 conf 文件时,它也没有开始工作。

我已经尝试弄清楚我的编码,所以我在模板上下文中添加了这个变量:

context['locale'] = sys.getfilesystemencoding()

在模板中显示“ANSI_X3.4-1968”

请有人解释一下为什么改变环境没有解决问题?

【问题讨论】:

  • 问题解决了吗?我在 Ubuntu 上遇到了同样的问题。
  • 你好@RankoR,不,我们刚刚迁移到 Python 3 %)

标签: django nginx supervisord


【解决方案1】:

确保您已完全重新启动 supervisord,如 here 所述。希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-13
    • 2014-10-20
    • 2021-12-11
    • 2019-01-11
    • 2016-08-30
    • 2015-04-25
    • 2011-07-28
    相关资源
    最近更新 更多