OK, so I got it working on my mac and thought I would share what I did to get it to work. I followed most of what was in this thread, but with some modifications:
1- Install Ampps
2 - make a folder in your Ampps installation folder, in my case it was here:
/Applications/AMPPS/www/wsgi-scripts
3 - In the httpd.conf file found here:
/Applications/AMPPS/conf
configure Apache to allow WSGI scripts, I added the following lines to the virtualhost portion of the httpd.conf
Code
<Directory "/Applications/AMPPS/www/wsgi-scripts">
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /myapp "/Applications/AMPPS/www/wsgi-scripts/myapp.wsgi"
So the whole virtualhost tag looked like this:
Code
<VirtualHost 127.0.0.1:80>
<Directory "/Applications/AMPPS/www">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
allow from All
</Directory>
ServerName localhost
ServerAlias localhost 127.0.0.1
ScriptAlias /cgi-bin/ "/Applications/AMPPS/www/cgi-bin/"
DocumentRoot "/Applications/AMPPS/www"
ErrorLog "/Applications/AMPPS/apache/logs/error_log"
CustomLog "/Applications/AMPPS/apache/logs/access.log" combined
<Directory "/Applications/AMPPS/www/wsgi-scripts">
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /myapp "/Applications/AMPPS/www/wsgi-scripts/myapp.wsgi"
</VirtualHost>
4 - Edit the python.conf file, located here:
/Applications/AMPPS/conf
to look like this:
Code
LoadModule wsgi_module modules/mod_wsgi.so
<IfModule wsgi_module>
DirectoryIndex index.wsgi default.wsgi index.py default.py
</IfModule>
WSGIPythonPath "/Applications/AMPPS/python/Lib;/Applications/AMPPS/python/Lib/site-packages;/Applications/AMPPS/python/DLLs"
WSGIPythonHome "/Applications/AMPPS/python"
5-Make a test WSGI application and save it as myapp.wsgi so it should reside in the following folder:
/Applications/AMPPS/www/wsgi-scripts/
Paste the following code into the myapp.wsgi file that you created:
Code
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
6 - Restart Apache in Ampps (if it is already open) or Start it for the first time.
7 - load your python test app at
http://localhost/myapp
That should do it!