I am setting up a flask application on and
Ubuntu 12.04.3 LTS EC2 instance and everything seemed to be working well (i.e. I could get to the webpage via the publicly available url) until I tried to import a module (e.g. numpy) and realised the apache python differs from the
one I used to compile the mod_wsgi and also the
one I am using
I am running apache2.
The apache2 logs show the warnings (specifically the last line shows the path hasnt changed):
[warn] mod_wsgi: Compiled for Python/2.7.5.
[warn] mod_wsgi: Runtime using Python/2.7.3.
[warn] mod_wsgi: Python module path '/usr/lib/python2.7/:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib$
I have tried to set the path in my virtual host conf (my python is located in /home/ubuntu/anaconda/bin along with all of the other libraries):
WSGIPythonHome /home/ubuntu/anaconda
WSGIPythonPath /home/ubuntu/anaconda
<VirtualHost *:80>
ServerName xx-xx-xxx-xxx-xxx.compute-1.amazonaws.com
ServerAdmin
[email protected]
WSGIScriptAlias / /var/www/microblog/microblog.wsgi
<Directory /var/www/microblog/app/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/microblog/app/static
<Directory /var/www/FlaskApp/FlaskApp/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But I still get the warnings and the apache python path hasnt changed - where do I need to put the relevant directives to point apache at my python version and modules (e.g. scipy, numpy etc)?
Separately, could I have avoided this using virtual environments?
Thanks in advance.