'File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) ImportError: No module named django

Here is my INSTALLED_APPS in settings

INSTALLED_APPS = (

'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
`'mongoengine.django.mongo_auth'`,
'django.contrib.formtools',

)

First django dependencies can be solved smoothly. It comes the problem when processing 'mongoengine.django.mongo_auth'. When I print out the name in import(name) in /usr/lib/python2.7/importlib/init.py. The result is 'mongoengine.django'. I am pretty sure that django and mongoengine module is successfully installed.

So what the problem is? BTW, I use sudo to install module sudo pip install

Otherwise, it can not be installed because the modules are located in the root file directory.



Solution 1:[1]

Problem solved. New mongoengine did some modification.

pip uninstall mongoengine

and then install the older version

pip install mongoengine==0.9.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ezhihan