|
Install some dependencies: The use of apt-get here is wonderful because I didn't even have apache2 installed yet.
jd@hardy:~$ sudo apt-get install python-dev python-setuptools \ python-psycopg2 libapache2-mod-wsgi jd@hardy:~$ sudo easy_install pylons jd@hardy:~$ sudo easy_install genshiSet up a generic location for python egg cache:
jd@hardy:~$ sudo mkdir /home/pylons jd@hardy:~$ sudo chgrp www-data /home/pylons jd@hardy:~$ sudo chmod 770 /home/pylonsEnable mod-wsgi
jd@hardy:~$ cd /etc/apache2/mods-enabled jd@hardy:/etc/apache2/mods-enabled$ sudo ln -sf ../mods-available/mod-wsgi.* .Initialize your HelloWorld app
jd@hardy:~$ mkdir www jd@hardy:~$ cd /var/www; ln -sf /home/jd/www jd jd@hardy:~$ cd jd jd@hardy:~$ paster create -t pylons helloworld Selected and implied templates: Pylons#pylons Pylons application template Variables: egg: helloworld package: helloworld project: helloworld Enter template_engine (mako/genshi/jinja/etc: Template language) ['mako']: genshi Enter sqlalchemy (True/False: Include SQLAlchemy 0.4 configuration) [False]: Enter google_app_engine (True/False: Setup default appropriate for Google App Engine) [False]: Creating template pylons Creating directory ./helloworld Recursing into +package+ [...]Notice the choice of genshi as the template language.
Configure your wsgi handler
jd@hardy:~$ mkdir ~/etc jd@hardy:~$ cd etc; joe helloworld.wsgiThe helloworld.wsgi looks like this
import os, sys
sys.path.append('/home/jd/www/helloworld')
os.environ['PYTHON_EGG_CACHE'] = '/home/pylons'
from paste.deploy import loadapp
application = loadapp('config:/home/jd/www/helloworld/development.ini')
Edit your 000-default file
jd@hardy:~$ sudo joe /etc/apache2/sites-enabled/000-defaultAdd your WSGIScriptAlias
WSGIScriptAlias /jd/helloworld /home/jd/etc/helloworld.wsgiRestart Apache
jd@hardy:~$ sudo /etc/init.d/apache2 restartYou should be good to go!