我最近开始做同一个项目,我注意到一些我无法解决的奇怪问题。 运行Django developement server并在浏览器集中输入address之后,我在终端中得到以下输出:
[02/Oct/2012 00:38:08] "GET / HTTP/1.1" 200 482
[02/Oct/2012 00:38:09] "GET /static/style.css HTTP/1.1" 200 349
[02/Oct/2012 00:38:09] "GET / HTTP/1.1" 200 482
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 146, in get_response
response = debug.technical_404_response(request, e)
File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 432, in technical_404_response
'reason': smart_str(exception, errors='replace'),
File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 116, in smart_str
return str(s)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 235, in __repr__
return smart_str(u'<%s %s (%s:%s) %s>' % (self.__class__.__name__, self.urlconf_name, self.app_name, self.namespace, self.regex.pattern))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 52: ordinal not in range(128)
页面显示正常,服务器仍在工作,但我觉得这很烦人。我也很好奇这是怎么回事。
所以,过了一段时间我发现,如果我在网址.py不再显示错误消息。我的网址.py公司名称:
和应用程序/用户/网址.py公司名称:
# -*- encoding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns('articles.views',
url(r'^articles/$', 'article_list', {'all': True}, name='article_list'),
)
我也注意到样式.css文件isd/*位置:绝对; 工作不正常。我已经把边界设置好了
在Linux上,确保安装了
language-pack-xx
包,例如为所有支持的包(包括Python)提供英文翻译数据更新。在
然后确保在从终端运行脚本之前设置好您的语言环境设置
^{pr2}$文档:
man locale
,man setlocale
。在您的应用程序名称是否包含非ascii字符?在
相关问题 更多 >
编程相关推荐