- 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 !
Monday, January 28, 2013
Quick Setup - Python mod_wsgi and XAMPP
Subscribe to:
Post Comments (Atom)
Hello when I pasted this snippet in,
ReplyDeleteLoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /"C:/xampp/htdocs//"
">
Order allow,deny
Allow from all
httpd.conf file
I got this error,
19:36:36 [Apache] Status change detected: stopped
19:36:36 [Apache] Error: Apache shutdown unexpectedly.
19:36:36 [Apache] This may be due to a blocked port, missing dependencies,
19:36:36 [Apache] improper privileges, a crash, or a shutdown by another method.
19:36:36 [Apache] Press the Logs button to view error logs and check
19:36:36 [Apache] the Windows Event Viewer for more clues
19:36:36 [Apache] If you need more help, copy and post this
19:36:36 [Apache] entire log window on the forums
same for me. found any solution?
DeleteThis comment has been removed by the author.
ReplyDelete