Skip to content

Instantly share code, notes, and snippets.

@ricobl
Created August 7, 2012 16:36
Show Gist options
  • Save ricobl/3287118 to your computer and use it in GitHub Desktop.
Save ricobl/3287118 to your computer and use it in GitHub Desktop.
Quick install for django-nonrel with mongodb
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
github = "git://github.com/%s.git"
repos = [
"django-nonrel/django-nonrel",
"django-nonrel/nonrel-search",
"django-nonrel/djangotoolbox",
"django-nonrel/django-dbindexer",
"adieu/django-autoload",
"django-nonrel/django-testapp",
"django-nonrel/django-permission-backend-nonrel",
"django-nonrel/mongodb-engine",
"django-nonrel/mongodb-cache",
]
for repo in repos:
url = github % repo
dest = repo.split('/')[1]
if not os.path.isdir(dest):
os.system('git clone %s' % url)
print 'Installing %s' % dest
status = os.system('cd %s && pip install -qe .' % dest)
if status:
print "Couldn't install %s" % dest
import os
DATABASES = {
'default': {
'ENGINE': 'dbindexer', 'TARGET': 'mongo',
},
'mongo': {
'ENGINE': 'django_mongodb_engine',
'NAME': 'my_mongo_db',
},
}
AUTOLOAD_SITECONF = 'indexes'
SECRET_KEY = '=r-$b*8hglm+858&9t043hlm6-&6-3d3vfc4((7yd0dbrakhvi'
AUTHENTICATION_BACKENDS = (
'permission_backend_nonrel.backends.NonrelPermissionBackend',
)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'djangotoolbox',
# Permission backend must be after djangotoolbox
'permission_backend_nonrel',
'autoload',
'dbindexer',
)
MIDDLEWARE_CLASSES = (
# This loads the index definitions, so it has to come first
'autoload.middleware.AutoloadMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'django.core.context_processors.media',
)
# This test runner captures stdout and associates tracebacks with their
# corresponding output. Helps a lot with print-debugging.
TEST_RUNNER = 'djangotoolbox.test.CapturingTestSuiteRunner'
ADMIN_MEDIA_PREFIX = '/media/admin/'
TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'),)
ROOT_URLCONF = 'urls'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment