当我上传一些非拉丁名称的文件时出现错误:
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”
谁能解释一下为什么改变环境没有解决问题?
最佳答案
确保您已完全重新启动 supervisord,如所述 here .希望对您有所帮助!
关于Django、nginx、gunicorn、主管 : UnicodeEncodeError - when uploading non-latin named file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28137592/