How to use MongoDB with Django Framework and Python3
<p>I am a newbie to python,django, and mongoDB world. I've setup Django project (Virtualenv, Python3, Django==1.10.1 MongoDB) and installed some basic package requirements: </p>

<pre><code>Django==1.10.1
django-mongodb-engine==0.6.0
djangotoolbox==1.8.0
mongoengine==0.9.0
pymongo==3.3.0
</code></pre>

<p>but when I tried to syncdb using <code>python3 manage.py syncdb</code>, then it's showing </p>

<pre><code>~/virtenv/lib/python3.5/site-packages/django_mongodb_engine/base.py", line 272
    raise ImproperlyConfigured, exc_info[1], exc_info[2]
                              ^
SyntaxError: invalid syntax
</code></pre>

<p><strong>Settings.py</strong></p>

<pre><code>import os
import mongoengine
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'fvp_amu.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'fvp_amu.wsgi.application'


# Database

DATABASES = {
    'default' : {
        'ENGINE' : '',
        'NAME' : 'fvp_amu'
        }
    }

# Password validation

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

STATIC_URL = '/static/'
</code></pre>

<p>From the docs <a href="https://django-mongodb-engine.readthedocs.io/en/latest/topics/setup.html#configuration" rel="nofollow">django-mongodb-engine</a></p>

<pre><code>DATABASES = {
   'default' : {
      'ENGINE' : 'django_mongodb_engine',
      'NAME' : 'my_database'
   }
}
</code></pre>

python django mongodb python-3.x pymongo