我已将我的 django 应用程序从一台服务器移动到另一台服务器,并在它之后发现了媒体的奇怪错误:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-
packages/Django-1.1.1-py2.5.egg/django/core/handlers/base.py", line 92, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/views/static.py", line 51, in serve
if os.path.isdir(fullpath):
File "/usr/lib/python2.5/posixpath.py", line 195, in isdir
st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 44-46: ordinal not in range(128)
我试图访问的图像名称中实际上有西里尔符号,但它在以前的环境中没有造成问题
谢谢, 奥列格
请您参考如下方法:
首先,不要让 Django 为您的静态文件提供服务。看到这个:http://docs.djangoproject.com/en/dev/howto/static-files/
