views:

162

answers:

1

I have created a new environement in virtualenv with --no-site-packages and executed activate file. So, shouldn't my current Django app show any error? Environement doesn't have Django installed. I think, my site is using my old python with Django. How can I change it?
Maybe it's because my .htaccess file, here it is:

SetHandler mod_python
PythonPath  "['/home/usr/PythonEnvs/Django/bin/python', 'home/usr/apps'] + sys.path" 
PythonOption mod_python.importer.path "['/home/usr/PythonEnvs/Django/bin/python']+ sys.path" 
PythonHandler django.core.handlers.modpython
PythonDebug On 

SetEnv DJANGO_SETTINGS_MODULE application.settings 

SetEnv PYTHON_EGG_CACHE /tmp/egg-cache

What else should I do to use my environement?

+4  A: 

With mod_wsgi, you can set WSGIPythonHome to where your virtualenv is. mod_python doesn't let you set the interpreter easily, however (there may be a way involving setting PYTHONEXECUTABLE at apache startup).

See what bin/python (next to bin/activate) does to sys.path, and mimick it in the PythonPath directive. Write a page that displays the current sys.path and make sure the system python path doesn't appear; if it does, edit it further with PythonPath.

Tobu
+1. The OP (and everyone else) should be using mod_wsgi anyway.
Daniel Roseman
For mod_wsgi see 'http://code.google.com/p/modwsgi/wiki/VirtualEnvironments'.
Graham Dumpleton