django+httpd+mod_pythonurl存在中文路径问题解决
2013-01-16 16:51
288 查看
djangobook
If you get a UnicodeEncodeErrorIf you're taking advantage of the internationalization features of Django (seeInternationalization)
and you intend to allow users to upload files, you mustensure that the
environment used to start Apache is configured to acceptnon-ASCII file
names. If your environment is not correctly configured, youwill trigger
UnicodeEncodeError exceptions when calling functions likeos.path() on
filenames that contain non-ASCII characters.
To avoid these problems, the environment used to start Apache should containsettings analogous to the following:
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
Consult the documentation for your operating system for the appropriate
syntaxand location to put these configuration items;
/etc/apache2/envvars is acommon location on Unix platforms. Once you
have added these statementsto your environment, restart Apache.
1.在ubuntulinux中只需修改/etc/apache2/envvars
在redhat中不存在那个文件那么在/etc/profile添加上相应内容即可。
2.重启apache服务。
If you get a UnicodeEncodeErrorIf you're taking advantage of the internationalization features of Django (seeInternationalization)
and you intend to allow users to upload files, you mustensure that the
environment used to start Apache is configured to acceptnon-ASCII file
names. If your environment is not correctly configured, youwill trigger
UnicodeEncodeError exceptions when calling functions likeos.path() on
filenames that contain non-ASCII characters.
To avoid these problems, the environment used to start Apache should containsettings analogous to the following:
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
Consult the documentation for your operating system for the appropriate
syntaxand location to put these configuration items;
/etc/apache2/envvars is acommon location on Unix platforms. Once you
have added these statementsto your environment, restart Apache.
1.在ubuntulinux中只需修改/etc/apache2/envvars
在redhat中不存在那个文件那么在/etc/profile添加上相应内容即可。
2.重启apache服务。
相关文章推荐
- 解决Python 爬虫URL中存在中文或特殊符号无法请求的问题
- 解决URl中文路径乱码问题
- paip.解决中文url路径的问题图片文件不能显示
- Django后台开发笔记①:关于DjangoUeditor与python3存在兼容性问题的解决方案(即解决图片无法上传问题)
- pythonanywhere下django无法匹配url问题解决
- 解决python3 网络请求路径包含中文的问题
- Apache2.2和Tomcat5.0的整合(二)—解决REDIRECT_URL的中文路径问题
- 解决python爬虫中有中文的url问题
- 如何解决python不支持中文路径的问题?
- Python 爬虫 URL中存在中文或特殊符号无法请求的解决方法
- python django MySQLdb 连接 mysql 5.5 中文乱码问题的解决
- Apache-2.2.8+mod_encoding解决URL中文编码问题-2008.1.8
- Apache2.2+mod_encoding解决URL中文编码问题
- iOS中文文件名传输或url中存在汉字解决办法(urldecode解码的问题)
- [UnicodeEncodeError]:Django中解决URL中文解释乱码问题
- Apache2.2+mod_encoding解决URL中文编码问题-2008.1.8
- 解决python中路径中包含中文无法找到文件的问题
- python3下 解决cv2读取中文路径问题
- Apache2.2+mod_encoding解决URL中文编码问题