I am new to Mongo DB and Django. I've been trying to use Mongo DB as my primary Database for Django. I've installed MongoDB and Django-nonrel as per the following link:
The version of django-nonrel, i am using is 1.7. Clone link to it:
pip install git+https://github.com/django-nonrel/django@nonrel-1.7
After following all steps, my settings.py in the django project file looks something like this:
DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine',
'NAME': 'blink',
'USER': '',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': 1234,
}
}
INSTALLED_APPS = (
'djangotoolbox',
)
But while running the manage.py using the following command:
python manage.py runserver
I am getting an error like this,
System check identified no issues (0 silenced).
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x104a95f80>
Traceback (most recent call last):
File "/Users/sunilkumar/blink/lib/python3.3/site-packages/django/utils/autoreload.py", line 222, in wrapper
fn(*args, **kwargs)
File "/Users/sunilkumar/blink/lib/python3.3/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
self.check_migrations()
File "/Users/sunilkumar/blink/lib/python3.3/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/Users/sunilkumar/blink/lib/python3.3/site-packages/django/db/utils.py", line 242, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/sunilkumar/blink/lib/python3.3/site-packages/django/db/utils.py", line 108, in load_backend
return import_module('%s.base' % backend_name)
File "/Users/sunilkumar/blink/lib/python3.3/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 853, in _load_module
File "<frozen importlib._bootstrap>", line 980, in get_code
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/Users/sunilkumar/blink/lib/python3.3/site-packages/django_mongodb_engine/base.py", line 265
raise ImproperlyConfigured, exc_info[1], exc_info[2]
^
SyntaxError: invalid syntax
I am not able to understand what the error is. Can somebody please help.?
It seems that you are using Python 3. But django-mongodb-engine
, on which django-nonrel
depends, doesn't even support Python 3 yet.
The syntax error above is actually valid in py3, but not in py2. Thus the error.
Perhaps you should consider using py2 for this project.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.