pythondjangomongodbdjango-nonreldjango-mongodb-engine

How to setup MongoDB with Django


I've followed numerous tutorials on how to setup a Django project with MongoDB but still get the same errors when running the command for testing:

python manage.py runsever

Here is the link I've been following:

http://www.allbuttonspressed.com/blog/django/2010/05/MongoDB-backend-for-Django-nonrel-released

Here are the errors I get from the above command:

Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10d266210>>
Traceback (most recent call last):

File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
self.validate(display_num_errors=True)

File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)

File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors
from django.db import models, connection

File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])

File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)

File "/Library/Python/2.7/site-packages/django/db/utils.py", line 92, in __getitem__
backend = load_backend(db['ENGINE'])

 File "/Library/Python/2.7/site-packages/django/db/utils.py", line 24, in load_backend
return import_module('.base', backend_name)

 File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)

File "build/bdist.macosx-10.8-intel/egg/django_mongodb_engine/__init__.py", line 13, in <module>

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

I have no idea why this isn't working and ideally I just want a database setup to use specifically for storing JSON documents. Is there an easier alternative to connecting Django with another database that is ideal for storing JSON information?


Solution

  • For clarification:

    INSTALLED_APPS should be tuple.

    He gets AttributeError: 'tuple' object has no attribute 'insert' because mongodb does not handle tuple INSTALLED_APPS correctly. The default in mongodb is insert list. This is already fix before but now it's gone.

    There suggestion are: