AttributeError: 'tuple' object has no attribute 'insert'

元气小坏坏 提交于 2019-12-08 05:16:10

问题


I have installed the following, from http://www.django-mongodb.org/topics/setup.html

django-nonrel

djangotoolbox

mongodb-engine

after installing i tried to run my program using python manage.py runserver

it showing an error like the following,

Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1655450>>
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 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/db/utils.py", line 27, in load_backend
    return import_module('.base', backend_name)
  File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/sakeer/workspace/entevirtual/lib/python2.7/site-packages/django_mongodb_engine-0.4.0-py2.7.egg/django_mongodb_engine/__init__.py", line 13, in <module>

AttributeError: 'tuple' object has no attribute 'insert'

i am using Django 1.5 and python 2.7

thanks in advance


回答1:


django-mongodb-engine expects settings.INSTALLED_APPS to be a list for some reason.

You'll have to change your

INSTALLED_APPS = (
   .. apps ..
)

to

INSTALLED_APPS = [
   .. apps ..
]

This is totally django-mongodb-engine's fault and they should feel bad.

 

They have this issue for seven months and show no concern.



来源:https://stackoverflow.com/questions/15381603/attributeerror-tuple-object-has-no-attribute-insert

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!