Normal Installation

Get MongoDB:

Download the right version per

Get the code:

pip install django-mongonaut==0.2.20

Install the dependency in your settings file (


Add the mongonaut file to your urlconf file:

urlpatterns = patterns('',
    url(r'^mongonaut/', include('mongonaut.urls')),

Also in your settings file, you’ll need something like:

# mongodb connection
from mongoengine import connect

You will need the following also set up:

  • django.contrib.sessions
  • django.contrib.messages


No need for autodiscovery() with django-mongonaut!

Static Media Installation

By default, django-mongonaut uses static media hosted by other services such as Google or Github. If you need to point to another location, then you can change the following defaults to your new source:

# defaults

Heroku MongoDB connection via MongoLabs

Your connection string will be provided by MongoLabs in the Heroku config. To make that work, just use the following code instead the # mongodb connection example:

# in your settings file (
import os
import re
from mongoengine import connect
regex = re.compile(r'^mongodb\:\/\/(?P<username>[_\w]+):(?P<password>[\w]+)@(?P<host>[\.\w]+):(?P<port>\d+)/(?P<database>[_\w]+)$')
mongolab_url = os.environ['MONGOLAB_URI']
match =
data = match.groupdict()
connect(data['database'], host=data['host'], port=int(data['port']), username=data['username'], password=data['password'])