On Tue, Feb 18, 2014 at 1:11 PM, knowledge_seeker <
[email protected]> wrote:

> I understand the importance of doing projects in virtual environments, but
> I am hitting one snag.
>
> When I have an error in django, and I get the generated webpage with an
> error message, it shows the 'normal' python path, site packages installed,
> etc. For example, I have jinja on my main installation, but not in the
> virtual environment. Yet, jinja shows up in this message as one of the site
> packages; similarly with the other python packages. Is there any way to
> show the python version (and location) and correct site-packages that are
> in the virtual environment in these error messages?
>

It sounds like you've built a virtualenv with --system-site-packages
enabled. If you've got an earlier version of virtualenv (IIRC, version 1.4
or earlier), this was the default option when you created a virtualenv.
When you construct a virtualenv in this way, it's an extension of your
system - so anything in your system PYTHONPATH will also show up in your
virtualenv.

If, on the other hand, you create your virtualenv with --no-site-packages
(which is the default on more recent versions of virtualenv), the
virtualenv is completely isolated. If you don't install a package in your
virtualenv, it won't be available.

To check what version of virtualenv you have, the usual --version flag
works; if you run --help, the description for --no-site-packages will tell
you whether it's the default or not.

As for checking where a package has come from -- if you're in a Python
shell, you can ask Python itself where it got a module. For example:

>>> import django
>>> django.__file__
'/Users/rkm/.virtualenvs/sample/lib/python2.7/site-packages/django/__init__.pyc'

tells you that I'm getting Django from the version installed in my "sample"
virtualenv.

I hope that helps.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq84-p3DhEGOBxTbfxSw1kN_AvUG%3DyUTf8bO0UZ10cpp5sNg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to