Using Python in the web. Setup Apache the way that you can run Python backend on it.
Apache
You need mod_wsgi to run Python based web applications on top of the Apache web server.Add to your vhosts.conf file, between "DirectoryMatch" tags:Source code viewer
# Add the following line to "/etc/httpd/conf/httpd.conf" or wherever your apache configuration file is.
LoadModule wsgi_module modules/mod_wsgi.soProgramming Language: Apache configuration
Source code viewer
Options ExecCGI
AddHandler wsgi-script .wsgiProgramming Language: Text
Python
Create index.wsgi to your root directory and put this code into it.Source code viewer
def wsgi_app(environ, start_response):
output = "<html><body><h1>WSGI working!</h1></body></html>\n".encode('utf-8')
status = '200 OK'
headers = [('Content-type', 'text/html'),
('Content-Length', str(len(output)))]
start_response(status, headers)
yield output
# mod_wsgi needs the "application" variable to serve our small app
application = wsgi_appProgramming Language: Python