1

I want to use MongoDB as database backend for my Django project. Although there are many discussions on the net, I'm having troubles to integrate them well.

My goals:

  • use default Django (so no django-nonrel, which is still to 1.3)

  • integrate them so that authentication is backed by MongoDB (i.e. the default User model) as well as the sessions thing.

  • if possible, still have a ORM-like query system

As I understand that, mongoengine could meet all my requirements, but I'm having troubles making it work correclty.
Docs say to ignore DATABASES setting. If I don't specify it, Django raises an error, while if I fill it, Django creates that database and does not use my MongoDB instance, even though I call connect() later in the file. When I run syncdb Django uses the other database (the one I specified in the DATABASES setting) and not MongoDB. So when I fire up MongoDB shell I can see the database is created, but the only collection is startup_log, which I never created and I suspect it's created automatically.

4

1 回答 1

1

This might be a change in the default requirements does adding a dummy backend to your settings help?

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.dummy'
    }
}
于 2013-04-10T12:06:11.563 回答