erm*_*mik 2 python django encoding
尝试访问站点媒体文件夹中的任何文件时出现.
在调试模式下显示完整的回溯:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/site-media/img/image.png
Django Version: 1.2.3
Python Version: 2.7.0
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.markup',
'special']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "C:\Languages\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
100. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Languages\Python27\lib\site-packages\django\views\static.py" in serve
59. mimetype = mimetypes.guess_type(fullpath)[0] or 'application/octet-stream'
File "C:\Languages\Python27\lib\mimetypes.py" in guess_type
294. init()
File "C:\Languages\Python27\lib\mimetypes.py" in init
355. db.read_windows_registry()
File "C:\Languages\Python27\lib\mimetypes.py" in read_windows_registry
260. for ctype in enum_types(mimedb):
File "C:\Languages\Python27\lib\mimetypes.py" in enum_types
250. ctype = ctype.encode(default_encoding) # omit in 3.x!
Exception Type: UnicodeDecodeError at /site-media/img/image.png
Exception Value: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)
它似乎是Python 2.7 mimetypes.py中的一个问题.请看以下讨论主题:
http://groups.google.com/group/django-users/browse_thread/thread/613909b35a7462a0
有一个俄文文章的链接,说谷歌翻译时:
标准库源Python的存在 - 并允许我们很快找到问题.Windows XP.我使用的是Windows XP.[HKEY_CLASSES_ROOT\CLSID {4063BE15-3B08-470D-A0D5-B37161CFFD69}\EnableFullPage\MIME]在我的情况下,问题是在[HKEY_CLASSES_ROOT\CLSID\{4063BE15-3B08-470D-A0D5-B37161CFFD69}\EnableFullPage \下的注册表中MIME]包含包含西里尔字母名称的子部分.如果删除这些键,它们将自动重新创建.因此有助于重命名,刚刚取代拉丁语中的西里尔字母.
以下是文章:http: //translate.google.fr/translate?js = n&prev = _t&hl = fr&ie = UTF-8<out = 2 &eotf = 1&sl = ru&tl = en&u = http%3A%2F%2Fvictor-k-development.blogspot .COM%2F2010%2F07%2Funicodedecodeerror-django.html
| 归档时间: |
|
| 查看次数: |
1334 次 |
| 最近记录: |