Question

Im using the following travis-ci configuration

language: python
env:
  - DJANGO=1.4
  - DJANGO=1.5
  - DJANGO=1.6
python:
  - "2.6"
  - "2.7"
install:
  - sudo pip install Django==$DJANGO
  - sudo pip install .
script:
  - cd autotest
  - python manage.py test ...

But in everytime the tests are executed, I run into the following issue:

$ python manage.py test ...
Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

The command "python manage.py test ..." exited with 1.
Was it helpful?

Solution

As i said on irc,

You are running pip install as root. More than that, sudo will reset the environment before finding and running pip. This will mean your pip install is not into the virtualenv that travis provides, but into the global site-packages.

When you do python manage.py test you are using the python binary provided by a virtualenv. However virtualenv will not look in the system site-packages. So it cannot see the Django you installed into the system site-packages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top