Monday, September 27, 2010

Django nonrel + MongoDB.

I want to setup a basic virtualenv environment with a working version of django-nonrel with MongoDB.

From http://www.allbuttonspressed.com/projects/django-nonrel we can read a blog entry that explains everything about the integration: http://www.allbuttonspressed.com/blog/django/2010/05/MongoDB-backend-for-Django-nonrel-released

With requirements.txt:

pymongo
-e git+http://github.com/aparo/django-mongodb-engine.git#egg=django_mongodb_engine
-e hg+http://bitbucket.org/wkornewald/django-nonrel#egg=Django
-e hg+http://bitbucket.org/wkornewald/djangotoolbox#egg=djangotoolbox


Type:


aptitude install python-pip
pip install virtualenv
virtualenv --no-site-packages --distribute nonrel
cd norel
. bin/activate
pip -r ../requirements.txt
bin/django-admin.py startproject myproject


Define your database as:


DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine.mongodb',
'NAME': 'test',
'USER': 'test',
'PASSWORD': 'test',
'HOST': 'flame.mongohq.com',
'PORT': 99999,
'SUPPORTS_TRANSACTIONS': False,
}
}


Pretty easy.

No comments: