I thought someone might be interested in this: For educational and testing purposes, I wanted to run the code examples from
webpy.org (wiki, blog, ...) from a subdirectory (/test/web-py/) of my server (
example.com), on which the main content is also served from a web.py app.
After some fruitless trial-and-error, I searched around found a post on
serverfault.com[1] which handled a similar issue, and used that solution for my purpose. Here is the specific snippet of my apache2 configuration:
<VirtualHost *:80>
# Aliases (most deeply nested URL should come first):
AddType text/html .py
WSGIApplicationGroup %{GLOBAL}
AddHandler wsgi-script .py
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride None
Order allow,deny
allow from all
</Directory>
Options Indexes FollowSymLinks MultiViews ExecCGI
AuthType Basic
AuthName 'Restricter'
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
AllowOverride None
Order allow,deny
allow from 11.22.33.44
</Directory>
WSGIApplicationGroup %{GLOBAL}
AddHandler wsgi-script .py
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride None
Order allow,deny
allow from 11.22.33.44
</Directory>
WSGIApplicationGroup %{GLOBAL}
AddHandler wsgi-script .py
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride None
Order allow,deny
allow from 11.22.33.44
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
</VirtualHost>