2013-03-13 53 views
1

我已经安装了以下,从link的MongoDB和Django的类型错误:__init __()到底需要2个参数(1给出)

django-nonrel 

djangotoolbox 

mongodb-engine 

,我改变了我的installed_apps

INSTALLED_APPS = (
    .. apps .. 
) 

INSTALLED_APPS = [ 
    .. apps .. 
] 

但我得到如下错误,

Validating models... 

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x12b8450>> 

Traceback (most recent call last): 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run 
    self.validate(display_num_errors=True) 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/base.py", line 280, in validate 
    num_errors = get_validation_errors(s, app) 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors 
    from django.db import models, connection 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module> 
    backend = load_backend(connection.settings_dict['ENGINE']) 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__ 
    return getattr(connections[DEFAULT_DB_ALIAS], item) 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/db/utils.py", line 94, in __getitem__ 
    conn = backend.DatabaseWrapper(db, alias) 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django_mongodb_engine-0.4.0-py2.7.egg/django_mongodb_engine/base.py", line 88, in __init__ 
    File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/djangotoolbox-0.9.2-py2.7.egg/djangotoolbox/db/base.py", line 28, in __init__ 

TypeError: __init__() takes exactly 2 arguments (1 given) 

我使用的Django 1.5蟒蛇提前2.7

感谢

+0

INSTALLED_APPS应该是一个元组......为什么你将它改为列表? – daveoncode 2013-03-13 11:18:38

+1

https://groups.google.com/forum/?fromgroups=#!topic/django-non-relational/MNElvfY0Irw – catherine 2013-03-13 11:23:01

+0

http://stackoverflow.com/questions/15381603/attributeerror-tuple-object-has-no-属性插入 – Sakeer 2013-03-13 11:50:30

回答

1

django-nonrel是的Django 1.3的一个分支,所以你不能使用Django 1.5中使用它。尝试卸载Django 1.5。

+0

我放弃了与django使用mongodb的想法,因为它没有正式支持...我的选择一直很难但对,我很高兴:) – daveoncode 2013-03-13 11:54:05

+0

我已经卸载Django 1.5并安装了1.3,但现在我面临另一个问题,ValueError:无法配置过滤器'require_debug_false':无法解析'django.utils.log.RequireDebugFalse':没有名为RequireDebugFalse的模块 – Sakeer 2013-03-14 05:06:03

+0

卸载django并运行'pip install git + https://github.com/django-nonrel/django @ nonrel-1.5'或从'settings.py'中删除'LOGGING' – softvar 2014-04-30 05:35:09

相关问题