如何使用Apache从根本上运行python脚本?
关于如何使用apache运行基本的python脚本,有多种方法,但没有明确的教程或任何在线内容 mod_python?cgi?wsgi python是否需要安装一些东西 真让人困惑。我已经做了几个小时了。Flow 客户端访问一个网页,比如(问题1)。您的服务器(apache)应该知道mangojuice引用/etc/www/superhightechjuice/mango.py。现在应该执行这个python文件(问题2)。Apache应该知道.py应该被执行,而不是直接提供。但是Python不知道何时唤醒并运行。因此需要另一个实体(问题3) 这三个问题(接口)的解决方案由mod_wsgi处理: WSGI继承了CGI概念(用于执行perl脚本和php脚本),扩展到Python脚本(具有附加功能)。mod_wsgi是Graham Dumpleton在Apache中实现它的方式,现在已成为标准如何使用Apache从根本上运行python脚本?,python,apache,web,Python,Apache,Web,关于如何使用apache运行基本的python脚本,有多种方法,但没有明确的教程或任何在线内容 mod_python?cgi?wsgi python是否需要安装一些东西 真让人困惑。我已经做了几个小时了。Flow 客户端访问一个网页,比如(问题1)。您的服务器(apache)应该知道mangojuice引用/etc/www/superhightechjuice/mango.py。现在应该执行这个python文件(问题2)。Apache应该知道.py应该被执行,而不是直接提供。但是Python不知
def application(environ, start_response):
status = '200 OK'
message = b"Hello World" #Prefix b is useful to convert string to bytestring, which is needed by HTTP
response_header = [('Content-type', 'text/html')]
start_response(status, response_header)
return [message]