WSGI runs the Python interpreter on web server start

1. Install mod_wsgi

    [root@unihost ~]# yum -y install mod_wsgi

2. Configure mod_wsgi to get access /user_wsgi  backend /var/www/html/user_wsgi.py.

   [root@unihost ~]# vi /etc/httpd/conf.d/wsgi.conf

WSGIScriptAlias /user_wsgi /var/www/html/user_wsgi.py

3. Create a test script

   [root@unihost ~]# vi /var/www/html/user_wsgi.py

def application(environ,start_response):
    status = '200 OK'
    html = '<html>\n' \
           '<body>\n' \
           '<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">\n' \
           'mod_wsgi Test Page\n' \
           '</div>\n' \
           '</body>\n' \
           '</html>\n'
    response_header = [('Content-type','text/html')]
    start_response(status,response_header)
    return [html]

4. Open your website