- Install XAMPP 1.7.7 from ( the latest XAMPP has apache 2.4 which isn't supported by mod_wsgi yet)
sourceforge.net/projects/xampp/files/XAMPP Windows/1.7.7/xampp-win32-1.7.7-VC9-installer.exe
- Download mod_wsgi.so from
https://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py27-3.3.so - rename the .so file to mod_wsgi.so
- copy the mod_wsgi.so file to xampp/apache/modules directory (this is where all the other .so modules reside)
- Edit the httpd.conf file from (C:\xampp\apache\conf\httpd.conf) and add the below code at the end of page:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /<yourfoldername>"C:/xampp/htdocs/<yourfoldername>/"
<Directory "C:/xampp/htdocs/<yourfoldername>">
Order allow,deny
Allow from all
</Directory>
- Now Write the below hello world code in a myapp.py file and save it in the htdocs/<yourfoldername>
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] - visit your localhost/<yourfoldername>/myapp.py
Cheers! on your first python WSGI application !
ENKODING
Monday, January 28, 2013
Quick Setup - Python mod_wsgi and XAMPP
Subscribe to:
Posts (Atom)