I'm trying to run Python within a sandbox using WSGI and Apache.
I created the virtual environment:
virtualenv /var/www/demo-environment --python /usr/bin/python3.3I also created the following
/var/www/demo.pyfile:#!/usr/bin/env python import sys def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) return "Running " + str(sys.version_info)Finally, I changed Apache configuration like this:
WSGIPythonPath /var/www/demo-environment/lib/python3.3/site-packages/ WSGIDaemonProcess example.com python-path=/var/www/demo-environment/lib/python3.3/site-packages/ WSGIProcessGroup example.com WSGIScriptAlias / /var/www/demo.py
When going to the home page of the website, it shows the following contents: Running sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0), indicating that while Python works, it is not called within a virtual environment.
Since this is the wrong way to enable virtualenv, which is the right one?