Last active
January 12, 2017 11:04
-
-
Save kodekracker/a35b45bf342fe7da9ddf to your computer and use it in GitHub Desktop.
A file contains settings required to setup mongoengine (http://mongoengine.org/) in Django Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import module | |
| import mongoengine | |
| # Django Database settings | |
| DATABASES = { | |
| 'default': { | |
| 'ENGINE': 'django.db.backends.dummy', | |
| }, | |
| } | |
| # MongoEngine Settings | |
| AUTHENTICATION_BACKENDS = ( | |
| 'mongoengine.django.auth.MongoEngineBackend', | |
| ) | |
| MONGOENGINE_USER_DOCUMENT = 'mongoengine.django.auth.User' | |
| SESSION_ENGINE = 'mongoengine.django.sessions' | |
| SESSION_SERIALIZER = 'mongoengine.django.sessions.BSONSerializer' | |
| _MONGODB_USER = 'admin' | |
| _MONGODB_PASSWD = 'password' | |
| _MONGODB_HOST = 'localhost' | |
| _MONGODB_NAME = 'db-name' | |
| _MONGODB_DATABASE_HOST = 'mongodb://%s:%s@%s/%s' \ | |
| % (_MONGODB_USER, _MONGODB_PASSWD, _MONGODB_HOST, _MONGODB_NAME) | |
| # Connect to mongodb | |
| mongoengine.connect(_MONGODB_NAME, host = _MONGODB_DATABASE_HOST) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment