This is in reply the request for Windows experience with "Running a
Pyramid Application under mod_wsgi" that was made in
I'm a newbie at Python, Pyramid, Apache and mod_wsgi, yet getting it
all to work wasn't as difficult as I had feared.
The final deployment steps on Windows turned out to be essentially the
same as those in the tutorial above.
Here's my setup and how I got to the end result:
A Windows developmental environment for Apache is provided by
A system-wide Python, plus the usual utilities virtualenv and
simple_install, are installed in D:\PF\Python27\.
For learning about, setting up and testing mod_wsgi with Apache, the
documentation at http://code.google.com/p/modwsgi/
proved to be clear,
thorough and indispensable.
Also valuable are the docs at the WSGI.org site. They contain
tutorials that further explain and explore WSGI applications.
Some simple tutorial scripts from WSGI.org were tested, initially
using the wsgiref Python server, and later using Apache+mod_wsgi.
Then, focus turned to learning Pyramid.
Create a new Python environment called PyramidEnv. D:\P\ is my Python
virtualenv --no-site-packages D:/P/PyramidEnv/
Activate this environment and install Pyramid in it:
Create and test the first non-trivial project, calling it MyProject:
Scripts\paster create -t pyramid_starter MyProject
..\Scripts\python setup.py develop
..\Scripts\python setup.py test -q
The test results returned an "OK", so paster's server was launched for
a browser test:
..\Scripts\paster serve development.ini
displayed MyProject's welcome screen.
A CTRL-C (or two) exited the server loop. To bring the system-wide
Python back, deactivate the PyramidEnv with:
Before continuing with the tutorial to enhance MyProject, test a
deployment of it to Apache+mod wsgi:
Create a WSGI script file in this directory, called RunMyProject,
containing two lines:
from pyramid.paster import get_app
application = get_app('D:/P/PyramidEnv/MyProject/production.ini',
Set up Apache's mod_wsgi in the header portion of its httpd.conf file:
WSGIScriptAlias /PE/ D:/P/PyramidEnv/
The trailing '/' on '/PE/' indicates that the name of the WSGI script
to be executed will be specified in the requesting URL.
And allow Apache to access D:/P/PyramidEnv/ with these commands, also
in the header section of httpd.conf:
Allow from all
confirms that Apache+mog_wsgi serves
up MyProject's welcome screen.