views:

35

answers:

2

Hi

I've setup a virtualenv for my existing Django project. So far it only uses django, but now I've tried to install Pisa package. It was installed successfully with pip in virtualenv, but when I try to import its package in django shell I get

No module named ho.pisa

So far I've not found a solution to this problem, moreover there seems to be no such problems for other people.

Could You please help me with this?

Edited: Well, it seems that it is sufficient to add:

import site
vepath = '/path_to_ve_created_for_the_project/lib/python2.6/site-packages'

# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)

And it works. However, is this the cleanest way of doing this?

A: 

Are you sure the virtualenv has been activated? Doing that is supposed to add the site-packages dir to your Pythonpath automatically. You need to do source bin/activate in the shell before loading Python.

Daniel Roseman
Yes, I did this, after doing this activation I've run django shell with "./manage.py shell"
Marcin Cylke
A: 

Well, it seems that it is sufficient to add:

import site
vepath = '/path_to_ve_created_for_the_project/lib/python2.6/site-packages'

# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)

And it works. However, is this the cleanest way of doing this?

Marcin Cylke