Django升级1.9.6出现的中文本地化bug
来源:互联网 发布:淘宝评价非欧什么意思 编辑:程序博客网 时间:2024/06/06 03:02
Error日志:
Error opening file for reading: Permission deniedERROR Internal Server Error: /Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 174, in get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 172, in get_response response = response.render() File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", line 160, in render self.content = self.rendered_content File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", line 137, in rendered_content content = template.render(context, self._request) File "/usr/local/lib/python2.7/dist-packages/django/template/backends/django.py", line 95, in render return self.template.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 206, in render return self._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 173, in render return compiled_parent._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 69, in render result = block.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/library.py", line 243, in render return t.render(new_context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 208, in render return self._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py", line 220, in render nodelist.append(node.render_annotated(context)) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 1043, in render output = self.filter_expression.resolve(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 736, in resolve new_obj = func(obj, *arg_vals) File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 51, in _dec return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 278, in truncatechars return Truncator(value).chars(length) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 194, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/utils/text.py", line 103, in chars for char in self.add_truncation_text('', truncate): File "/usr/local/lib/python2.7/dist-packages/django/utils/text.py", line 77, in add_truncation_text '%(truncated_text)s...') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 93, in pgettext return _trans.pgettext(context, message) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 326, in pgettext result = ugettext(msg_with_ctxt) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 321, in ugettext return do_translate(message, 'ugettext') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 298, in do_translate _default = _default or translation(settings.LANGUAGE_CODE) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 205, in translation _translations[language] = DjangoTranslation(language) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 118, in __init__ raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE)IOError: No translation files found for default language zh-CN.Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 177, in __call__ response = self.get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 230, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 284, in handle_uncaught_exception 'request': request File "/usr/lib/python2.7/logging/__init__.py", line 1166, in error self._log(ERROR, msg, args, **kwargs) File "/usr/lib/python2.7/logging/__init__.py", line 1258, in _log self.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 1268, in handle self.callHandlers(record) File "/usr/lib/python2.7/logging/__init__.py", line 1308, in callHandlers hdlr.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 748, in handle self.emit(record) File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 115, in emit message = "%s\n\n%s" % (self.format(no_exc_record), reporter.get_traceback_text()) File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 323, in get_traceback_text return t.render(c) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 206, in render return self._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 1043, in render output = self.filter_expression.resolve(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 736, in resolve new_obj = func(obj, *arg_vals) File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 778, in date return formats.date_format(value, arg) File "/usr/local/lib/python2.7/dist-packages/django/utils/formats.py", line 151, in date_format return dateformat.format(value, get_format(format or 'DATE_FORMAT', use_l10n=use_l10n)) File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 367, in format return df.format(format_string) File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 37, in format pieces.append(force_text(getattr(self, piece)())) File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 292, in r return self.format('D, j M Y H:i:s O') File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 37, in format pieces.append(force_text(getattr(self, piece)())) File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 78, in force_text s = six.text_type(s) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 114, in __text_cast return func(*self.__args, **self.__kw) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 85, in ugettext return _trans.ugettext(message) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 321, in ugettext return do_translate(message, 'ugettext') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 298, in do_translate _default = _default or translation(settings.LANGUAGE_CODE) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 205, in translation _translations[language] = DjangoTranslation(language) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 118, in __init__ raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE)IOError: No translation files found for default language zh-CN.[pid: 3318|app: 0|req: 1/1] 219.237.242.144 () {44 vars in 5238 bytes} [Fri May 6 10:19:53 2016] GET / => generated 0 bytes in 243 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)Error opening file for reading: Permission denied[pid: 3321|app: 0|req: 1/2] 68.180.229.29 () {32 vars in 469 bytes} [Fri May 6 10:21:04 2016] GET /ge/qqt-a653480/ => generated 19272 bytes in 272 msecs (HTTP/1.1 200) 3 headers in 195 bytes (1 switches on core 0)Error opening file for reading: Permission deniedERROR Internal Server Error: /Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 174, in get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 172, in get_response response = response.render() File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", line 160, in render self.content = self.rendered_content File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", line 137, in rendered_content content = template.render(context, self._request) File "/usr/local/lib/python2.7/dist-packages/django/template/backends/django.py", line 95, in render return self.template.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 206, in render return self._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 173, in render return compiled_parent._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 69, in render result = block.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/library.py", line 243, in render return t.render(new_context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 208, in render return self._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py", line 220, in render nodelist.append(node.render_annotated(context)) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 1043, in render output = self.filter_expression.resolve(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 736, in resolve new_obj = func(obj, *arg_vals) File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 51, in _dec return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 278, in truncatechars return Truncator(value).chars(length) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 194, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/utils/text.py", line 103, in chars for char in self.add_truncation_text('', truncate): File "/usr/local/lib/python2.7/dist-packages/django/utils/text.py", line 77, in add_truncation_text '%(truncated_text)s...') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 93, in pgettext return _trans.pgettext(context, message) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 326, in pgettext result = ugettext(msg_with_ctxt) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 321, in ugettext return do_translate(message, 'ugettext') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 298, in do_translate _default = _default or translation(settings.LANGUAGE_CODE) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 205, in translation _translations[language] = DjangoTranslation(language) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 118, in __init__ raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE)IOError: No translation files found for default language zh-CN.Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 177, in __call__ response = self.get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 230, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 284, in handle_uncaught_exception 'request': request File "/usr/lib/python2.7/logging/__init__.py", line 1166, in error self._log(ERROR, msg, args, **kwargs) File "/usr/lib/python2.7/logging/__init__.py", line 1258, in _log self.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 1268, in handle self.callHandlers(record) File "/usr/lib/python2.7/logging/__init__.py", line 1308, in callHandlers hdlr.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 748, in handle self.emit(record) File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 115, in emit message = "%s\n\n%s" % (self.format(no_exc_record), reporter.get_traceback_text()) File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 323, in get_traceback_text return t.render(c) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 206, in render return self._render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 197, in _render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 992, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 959, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 1043, in render output = self.filter_expression.resolve(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 736, in resolve new_obj = func(obj, *arg_vals) File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 778, in date return formats.date_format(value, arg) File "/usr/local/lib/python2.7/dist-packages/django/utils/formats.py", line 151, in date_format return dateformat.format(value, get_format(format or 'DATE_FORMAT', use_l10n=use_l10n)) File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 367, in format return df.format(format_string) File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 37, in format pieces.append(force_text(getattr(self, piece)())) File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 292, in r return self.format('D, j M Y H:i:s O') File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 37, in format pieces.append(force_text(getattr(self, piece)())) File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 78, in force_text s = six.text_type(s) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 114, in __text_cast return func(*self.__args, **self.__kw) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 85, in ugettext return _trans.ugettext(message) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 321, in ugettext return do_translate(message, 'ugettext') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 298, in do_translate _default = _default or translation(settings.LANGUAGE_CODE) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 205, in translation _translations[language] = DjangoTranslation(language) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 118, in __init__ raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE)IOError: No translation files found for default language zh-CN.
经确认是新版本的django包版本中只有zh_Hans目录,没有zh_CN,把zh_Hans目录复制一个zh_CN就Ok了
一楼评论的方法也不错,在settings里面直接改成zh-Hans,这样就不用升级完Django,还去改目录了。
0 0
- Django升级1.9.6出现的中文本地化bug
- Django 中文本地化汉化方法
- django中文本地化初步安装的全过程记录
- Django国际化与本地化实现网站的中文显示
- ADT22升级以后出现的bug解决方法
- CocoaPods的安装,升级以及升级以后出现bug的解决方法(升级必看!)
- CocoaPods的安装,升级以及升级以后出现bug的解决方法(升级必看!)
- CocoaPods的安装,升级以及升级以后出现bug的解决方法(升级必看!)
- 女朋友升级到妻子时出现的BUG(转载)
- 女朋友升级到妻子时出现的BUG
- 女朋友升级为妻子时出现的BUG
- Web应用的中文本地化
- Web应用的中文本地化
- WTL向导的中文本地化
- 【转】ReactOS的中文本地化
- 【Ajax】[bug] 通过 aJax 传入服务器的中文出现乱码
- Django的Markdown解bug
- 解决升级 npm 5 后出现的莫名其妙的 bug 的一些尝试
- 使用Command Line(终端)提交代码到远程库
- [一起学Hive]之三–Hive中的数据库(Database)和表(Table)
- Android 给图片、文字、控件、布局添加阴影效果(悬浮效果)
- 一个ListView使用多个布局文件
- 设计模式C++学习笔记之八(Adapter适配器模式)
- Django升级1.9.6出现的中文本地化bug
- hdu4498 Function Curve
- inside the c++ object
- C++基础知识——变量存储位置
- 织梦DedeCMS自增函数[field:global name=autoindex/]
- 动态规划经典问题--TSP问题
- Postgresql 远程同步(非实时同步,小数据量)
- [一起学Hive]之四-Hive的安装配置
- c++第六次上机作业