3

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:

Django==1.10.1
django-mongodb-engine==0.6.0
djangotoolbox==1.8.0
mongoengine==0.9.0
pymongo==3.3.0

but when I tried to syncdb using python3 manage.py syncdb, then it's showing

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

Settings.py

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/'
2
  • Please add your settings.py. Commented Sep 22, 2016 at 1:43
  • I have added setting.py @Windsooon Commented Sep 22, 2016 at 7:55

1 Answer 1

1

From the docs django-mongodb-engine

DATABASES = {
   'default' : {
      'ENGINE' : 'django_mongodb_engine',
      'NAME' : 'my_database'
   }
}
Sign up to request clarification or add additional context in comments.

3 Comments

He want it to be done for MongoDB you added instruction for PostGRES
sorry, my mistake.
improper configuration

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.