1

I created django web app that use mongo database , I connet to mongo with pymongo

 def load_database():
    mongo = pymongo.Connection('127.0.0.1')
    db = mongo['database'] 

when I tried to load my web app , I get error

Exception Type:

ImproperlyConfigured



Exception Value:

settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details. 


Exception Location:

Python-2.7/lib/python2.7/site-packages/django/db/backends/dummy/base.py in complain, line 15

it looks that settings.py is wrong configured , here is my settings.py :

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or     
'NAME': '',                      # Or path to database file if using sqlite3.
 # The following settings are not`enter code here` used with sqlite3:
'USER': '',
'PASSWORD': '',
'HOST': '',                      # Empty for localhost through domain sockets or   '
'PORT': '',                      # Set to empty string for default.
}
}

Can someone tell me what is wrong ? when I load homepage that don't coneect to mongo , only static files it loads fine , when I click on buttom on hoempage that gets data from mongo database and print out that data , I get this error . Also I tried python manage.py syncdb but gets error : ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

2 Answers 2

2

For proper working of mongoDB you should install these packages: Django-nonrel, djangotoolbox, mongodb-engine for Django.

And after that you can edit settings

DATABASES = {
   'default' : {
      'ENGINE' : 'django_mongodb_engine',
      'NAME' : 'my_database'
   }
}
Sign up to request clarification or add additional context in comments.

Comments

1

If you are using pymongo directly, you can just leave out the entire DATABASES variable from settings.py.

If you don't want to use pymongo directly, consider looking into mongoengine.

7 Comments

I use pymongo diretly but it looks that problem is not in pymongo, I just figure our it now, I use request.session , so that is why I get error, to use seasion variable I need to syncdb database , do you know how to do it ?
OK you need to specify a database backend to store the session data. You can use MongoDB for this using Mongoengine (see section 6.4).
when I add in my settings.py SESSION_ENGINE = 'mongoengine.django.sessions' , i get error ImportError Exception Value: No module named mongoengine.django.sessions
can someone check my settings. py , here is link where I upload it uploadmb.com/dw.php?id=1376987235
I can't run python manage.py syncdb and use seassion variables ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.