Monday, January 28, 2013

Quick Setup - Python mod_wsgi and XAMPP

Note: i have Preinstalled 32 bit python 2.7 on windows8
  1. Install XAMPP 1.7.7 from ( the latest XAMPP has apache 2.4 which isn't supported by mod_wsgi yet) Windows/1.7.7/xampp-win32-1.7.7-VC9-installer.exe 

  2. Download from
  3. rename the .so file to
  4. copy the file to xampp/apache/modules directory (this is where all the other .so modules reside)
  5. 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/
    WSGIScriptAlias /<yourfoldername>"C:/xampp/htdocs/<yourfoldername>/"
    <Directory "C:/xampp/htdocs/<yourfoldername>">
        Order allow,deny
        Allow from all

  6. Now Write the below hello world code in a 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]
  7. visit your localhost/<yourfoldername>/

    Cheers! on your first python WSGI application   !


  1. Hello when I pasted this snippet in,

    LoadModule wsgi_module modules/
    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

  2. This comment has been removed by the author.