4

I have installed Django(1.8.2) in my Ubuntu 16.04.
When I cloned a working project into it and run the server, I got the following error.

Traceback (most recent call last):
    File "manage.py", line 31, in <module>
      execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/django/core/management/__init__.py", line 338,  in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/usr/lib/python2.7/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib/python2.7/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/lib/python2.7/django/apps/config.py", line 119, in create
    import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
  __import__(name)
ImportError: No module named django

Observation(s):

  • I'm able to start a new project and run the server of the same.
  • The value of INSTALLED_APPS in settings.py is:

    INSTALLED_APPS = (
       'django.contrib.admin',
       'django.contrib.auth',
       'django.contrib.contenttypes',
       'django.contrib.sessions',
       'django.contrib.messages',
       'django.contrib.staticfiles',
       'Telecommands',
       'Telemetry',
       'captcha',
       'django.contrib.sitemaps',
       'djcelery',
       'kombu.transport.django',
       # 'grappelli',
       # 'chronograph',
       # 'registration', # Include the registration
    )
    

What have I tried?

  • Installing django using pip install django==1.8.2.
  • Since the error was reported with reference to /usr/lib/python2.7/,
    I tried:
    sudo pip install --install-option="--install-purelib=/usr/lib/python2.7/site-packages/" --ignore-installed django==1.8.2
  • Further, when I got confused with paths
    /usr/local/lib/python2.7/dist-packages,
    /usr/lib/python2.7/dist-packages/
    and ~/.local/lib/python2.7/dist-packages.
    I installed django(1.8.2) to each of these paths one by one,
    updating PYTHONPATH in parallel.
  • I did not get any errors while installing.

Can somebody help me out. Kindly explain the reason for the error as well.

2
  • Question is updated with INSTALLED_APPS vaule. Commented Nov 24, 2016 at 17:23
  • 1
    The latest Django 1.8.x release is currently 1.8.16. If you are running 1.8.2, then you are missing several security fixes. Commented Nov 24, 2016 at 20:48

1 Answer 1

4

The traceback shows you the error occurs in /usr/lib/python2.7/django/__init__.py, so manage.py has clearly found your Django installation. As an aside, it would be much better to use a virtual env instead of installing in /usr/lib/python2.7/site-packages/.

The problem appears to be that you have kombu.transport.django in your INSTALLED_APPS. The Django transport was removed from kombu in 4.0.

Sign up to request clarification or add additional context in comments.

4 Comments

Your fix worked. It was working fine with my team mates laptop. with same configurations. (Installed long back). :)
If it works on your team mate's laptop, they probably have kombu < 4.0 installed.
Could you please explain how this cause a problem. I'm bit amazed that an error in module somehow 'mask' another.
You get the error because you have kombu.transport.django in your INSTALLED_APPS, but it does not exist. Similarly if you had kombu.transport.foobar in INSTALLED_APPS, then you would get the error ImportError: No module named foobar. In that case, it would be clearer what the problem is, because the name doesn't clash.

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.