install ajp-wsgi

build ajp-wsgi from source.The URL: http://www.saddi.com/software/ajp-wsgi/

assume the working directory is ~/pkg

~/pkg>wget http://www.saddi.com/software/ajp-wsgi/dist/ajp-wsgi-1.0.tar.bz2
~/pkg>tar jxvf ajp-wsgi-1.0.tar.bz2
~/pkg/ajp-wsgi-1.0>python configure.py
~/pkg/ajp-wsgi-1.0>make
~/pkg/ajp-wsgi-1.0>cp -a ajp-wsgi /usr/local/bin

create run_ajp.py

assume your django project installed at ~/mydjapp, or /home/myname/mydjapp

~/mydjapp>cat run_ajp.py
# run_ajp.py
from django.core.handlers.wsgi import WSGIHandler
app = WSGIHandler()

source of the above run_ajp.py: http://d.hatena.ne.jp/perezvon/20080417/1208445705 (in Japanese)

startup ajp-wsgi

~/mydjapp>export DJANGO_SETTINGS_MODULE=settings   <---- this refer /home/myname/mydjapp/settings.py
~/mydjapp>export PYTHONPATH=/usr/local/lib/python2.4/site-packages/apps:/home/myname
~/mydjapp>ajp-wsgi run_ajp app /abc

Note: the above PYTHONPATH setting is just an example. It is “any additional directories to search for Python modules” (from http://www.saddi.com/software/ajp-wsgi/). It is depended on your django app.

litespeed setting

define an external app(type:“Servlet Engine”),address 127.0.0.1:8009, either server level or vHost level.

create a vhost “Servlet” context, URI is “/abc”, select above external app as “Servlet Engine”

then access the django app through

http://www.yourdomain.com/abc

  • Admin
  • Last modified: 2015/07/29 15:00
  • by Michael Alegre