mod_wsgi - Finding Out The Version

To determine whatever WSGI module is enabled or not, you can check a list of all loaded/enabled Apache modules.

But to find out which version of mod_wsgi is installed/compiled, it is required to create a simple WSGI application.

From the following article you will learn how to create and run on Apache a simple WSGI application that prints the version of installed/compiled mod_wsgi.

Read more: mod_wsgi - Example of Simple 'Hello World' Application

Create a directory for WSGI application:

# mkdir -p /usr/local/www/wsgi-scripts

Create a very simple WSGI application script version.wsgi that prints the version of mod_wsgi:

# /usr/local/www/wsgi-scripts/version.wsgi

def application(environ, start_response):
    status = '200 OK'
    output = str(environ['mod_wsgi.version'])
    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]

Depending on your distribution, create a virtual host in Apache:

# cat /etc/httpd/conf.d/
- or -
# cat /etc/apache2/conf.d/

<VirtualHost *:80>
    WSGIScriptAlias /version /usr/local/www/wsgi-scripts/version.wsgi
    <Directory /usr/local/www/wsgi-scripts>
    Order allow,deny
    Allow from all

Execute one of the below commands, depending on your distribution, to reload Apache and apply modifications:

# service httpd reload
- or -
# service apache2 reload

Use curl to run your WSGI application directly from the web-servers command line and print the version of mod_wsgi:

# curl http://localhost/version
(3, 5)