Skip to content

Instantly share code, notes, and snippets.

@mhtocs
Created July 12, 2018 18:03
Show Gist options
  • Save mhtocs/9ef0fecae20b56ffe2703e03799db4b7 to your computer and use it in GitHub Desktop.
Save mhtocs/9ef0fecae20b56ffe2703e03799db4b7 to your computer and use it in GitHub Desktop.
How to integrate django and mongodb using djongo

pipenv install djongo

add this to settings.py

DATABASES = {
    'default': {
        'ENGINE': 'djongo',
        'ENFORCE_SCHEMA': True,
        'NAME': 'db-name',
        'HOST': 'dx999999.mlab.com',
        'PORT': 35251,
        'USER': 'admin',
        'PASSWORD': 'admin123',
        'AUTH_SOURCE': 'db-name',
        'AUTH_MECHANISM': 'SCRAM-SHA-1',
    }
}

migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment