Here's a summary of what I've done
- I moved my django project to
/pymodules/honstreams - I've installed apache2 and apache2-dev
- I've installed pythonbrew, installed Python-2.7.2 and switched to it
- I've set PYTHONPATH to
/pymodulesin/etc/profileand confirmed that it works - I've compiled mod-wsgi.so using the correct python and apache versions
- I've added the wsgi module to httpd.conf
I've created a wsgi_handler.py instructed by this tutorial. This is it:
import sys import os sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..') os.environ['DJANGO_SETTINGS_MODULE'] = 'honstreams.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()I've configured apache VirtualHost instructed by the same tutorial. I edited
/etc/apache2/sites-enabled/000-defaultto this:<VirtualHost *> ServerName www.honstreams.com ServerAlias *honstreams.com Alias /admin_media /root/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/site-packages/django/contrib/ad$ <Location /admin_media> Order allow,deny Allow from all </Location> Alias /media /root/honstreams/website/media <Location /media> Order allow,deny Allow from all </Location> WSGIScriptAlias / /root/honstreams/wsgi_handler.py WSGIDaemonProcess honstreams user=www-data group=www-data processes=1 threads=10 WSGIProcessGroup honstreams </VirtualHost>
I start apache without errors. I try to access the root folder from http, and /var/log/apache2/error.log repeats:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
To be perfectly honest I haven't got a clue what to do next. I don't know what <prefix> or <exec_prefix> is and Google isn't being particularly helpful. I'm guessing I need to set the PYTHONHOME variable for user www-data.
Also I'm not trying to import a module named "site" in any of my code, anywhere, ever. Therefore I assume it'll fix itself if I fix the above errors.
Any help would be appreciated!
EDIT: I've set PYTHONHOME to /root/.pythonbrew/pythons/Python-2.7.2 in /etc/profile. I'm getting the exact same error as before. Does /etc/profile even have any effect when a user isn't being logged in at a shell?