AttributeError:“ Nonetype”对象没有属性“ _info” [英] AttributeError: 'Nonetype' object has no attribute '_info'
问题描述
我正在处理 Django
项目,当我尝试运行任何管理命令(例如:
python manage)时,会出现此错误。 .py validate --settings ord.settings.development
, python manage.py syncdb --settings ord.settings.development
。该项目使用 Django 1.5
错误是: AttributeError: Nonetype对象没有属性 _info
。没有给出其他输出。
I am working on a Django
project and this error arises when I try to run any management commands such as:
python manage.py validate --settings ord.settings.development
, python manage.py syncdb --settings ord.settings.development
. The project uses Django 1.5
The error is: AttributeError: 'Nonetype' object has no attribute '_info'
. No other output is given.
项目基本设置文件为: https://gist.github.com/anonymous/5c0fede63b2724d7880b
The project base settings file is: https://gist.github.com/anonymous/5c0fede63b2724d7880b
开发设置: https://gist.github.com/anonymous/f60b90dcf573b0a7b920
我已替换敏感设置 x
任何想法可能出问题吗?
Any idea what could be wrong?
一些额外的信息,当我注释掉 LANGUAGE_CODE
设置时,某些命令如 validate
, runserver
, shell
运行正常,但 syncdb
和迁移
失败,错误: DatabaseError:当前事务已中止,命令被忽略,直到事务块结束 c
Some extra info, when i comment out the LANGUAGE_CODE
settings, some commands like validate
, runserver
, shell
run fine but syncdb
and migrate
fail with error: DatabaseError: current transaction is aborted, commands ignored until end of transaction block
跟踪: https://gist.github.com/anonymous/bc3364ae5ba511566871
推荐答案
有同样的问题,
请按照以下步骤操作:
- 转到
django / utils /translation/trans_real.py
- 搜索
res = _translation(globalpath)
-
添加以下内容:
- go to
django/utils/translation/trans_real.py
- search for
res = _translation(globalpath)
Add the following:
if res is None:
return gettext_module.NullTranslations()
来源:https://code.djangoproject.com/ticket/18192
这篇关于AttributeError:“ Nonetype”对象没有属性“ _info”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!