Getting Error with rest_framework_mongoengine with django

185 views Asked by At

After serializing the model in view when i am trying to enter the RESTapi url getting error settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

using mongoengine so haven't set any database. Worked perfectly before tried api integration

settings.py

import mongoengine

DBNAME = 'database'
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
mongoengine.connect(DBNAME,host=MONGO_HOST, port=MONGO_PORT)

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'rest_framework_mongoengine',

'api'

)

DATABASES = {
'default': {
    'ENGINE': '',
    'NAME': '',
}

}

1

There are 1 answers

5
AudioBubble On

by mongo docs setup did you try it? by django docs databases to be used with Django but you just create mongoengine.connect inside your settins, and it does not used by django.

DATABASES = {
    'default' : {
        'ENGINE' : 'django_mongodb_engine',
        'NAME' : 'my_database'
    }
}

and have you look on the python-eve for create mongodb-restapi?