AttributeError:'Nonetype'对象没有属性'_info'

len*_*nny 6 python django

我正在研究一个Django项目,当我尝试运行任何管理命令时会出现此错误,例如: python manage.py validate --settings ord.settings.development,python manage.py syncdb --settings ord.settings.development.该项目使用Django 1.5的错误是:AttributeError: 'Nonetype' object has no attribute '_info'.没有给出其他输出.

项目基础设置文件是:https://gist.github.com/anonymous/5c0fede63b2724d7880b

开发设置:https://gist.github.com/anonymous/f60b90dcf573b0a7b920

我用的是替换了敏感设置 x

知道什么可能是错的吗?

一些额外的信息,当我注释掉LANGUAGE_CODE的设置,一些命令一样validate,runserver,shell运行良好,但syncdbmigrate失败,错误:DatabaseError: current transaction is aborted, commands ignored until end of transaction block

追溯:https://gist.github.com/anonymous/bc3364ae5ba511566871

mmr*_*151 16

有同样的问题,

请按照以下步骤操作:

  1. django/utils/translation/trans_real.py
  2. 搜索 res = _translation(globalpath)
  3. 添加以下内容:

    if res is None:
        return gettext_module.NullTranslations()
    
    Run Code Online (Sandbox Code Playgroud)

来源:https://code.djangoproject.com/ticket/18192


Gil*_* E. 7

在ubuntu 14.04上的新安装遇到了同样的问题.经过大量挖掘 - 以为我应该分享我的发现:我们正在使用django 1.5并且遇到了同样的错误.似乎django安装缺少文件夹django/conf/locale/en/LC_MESSAGES

解决方法是安装最新版本"pip install django == 1.5.12"

  • 哇,非常感谢!不知道它与 14.04 有什么关系,但我有 Django 1.3。复制 LC_MESSAGES 有帮助 (2认同)