Steps I followed :
- 'pip install git+htp://github.com/django-nonrel/django@nonrel-1.5'
It did not work, so I downloaded the zip from the site "htp://github.com/django-nonrel/django" and pasted the unzipped folder inside "c:\users\hp\appdata\local\temp\pip-m0d0y9bv-build".
- 'pip install git+htp://github.com/django-nonrel/djangotoolbox'
- 'pip install git+htp://github.com/django-nonrel/mongodb-engine'
NOTE
*** I have used 'htp' instead of 'https' as I have reputation less than 10.
- configured my settings.py file as follows:-
.
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '4j*aieq$cn&sewl0s2#&m00+^oe%qg9p=@mlva96_r48nv-pkl'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
'djangotoolbox',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'myproject.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 = 'myproject.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine',
'NAME': 'test',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': 27017,
}
}
SESSION_ENGINE = 'mongoengine.django.sessions'
SESSION_SERIALIZER = 'mongoengine.django.sessions.BSONSerializer'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
- I got the below error when i started running server using command 'python manage.py runserver'
.
c:\Python34\myproject>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
338, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
312, in execute
django.setup()
File "C:\Python34\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python34\lib\site-packages\django\apps\registry.py", line 108, in pop
ulate
app_config.import_models(all_models)
File "C:\Python34\lib\site-packages\django\apps\config.py", line 198, in impor
t_models
self.models_module = import_module(models_module_name)
File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Python34\lib\site-packages\django\contrib\auth\models.py", line 41, i
n <module>
class Permission(models.Model):
File "C:\Python34\lib\site-packages\django\db\models\base.py", line 139, in __
new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Python34\lib\site-packages\django\db\models\base.py", line 324, in ad
d_to_class
value.contribute_to_class(cls, name)
File "C:\Python34\lib\site-packages\django\db\models\options.py", line 250, in
contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length(
))
File "C:\Python34\lib\site-packages\django\db\__init__.py", line 36, in __geta
ttr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Python34\lib\site-packages\django\db\utils.py", line 240, in __getite
m__
backend = load_backend(db['ENGINE'])
File "C:\Python34\lib\site-packages\django\db\utils.py", line 111, in load_bac
kend
return import_module('%s.base' % backend_name)
File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1467, in exec_module
File "<frozen importlib._bootstrap>", line 1572, in get_code
File "<frozen importlib._bootstrap>", line 1532, in source_to_code
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Python34\lib\site-packages\django_mongodb_engine\base.py", line 272
raise ImproperlyConfigured, exc_info[1], exc_info[2]
^
SyntaxError: invalid syntax
What am I missing here ? I have followed the steps from django - mongoengine documentation. However, I am unable to figure out the issue. Please help me out of this.
Django-mongodb-engine does not appear to be compatible with Python 3. In any case, django-nonrel itself is based on Django 1.5, which is definitely not Python 3 compatible.