如何配置 apache2 mod_python
how to configure apache2 mod_python
我正在尝试使用 mod_python 到 运行 python 脚本配置 apache。我尝试了许多不同的配置,但 none 有效。我的 hello.py 文件看起来像这样
from mod_python import apache
def handler(req):
req.log_error('handler')
req.content_type = 'text/html'
req.send_http_header()
req.write('<html><head><title>Testing mod_python</title></head> <body>')
req.write('Hello World!')
req.write('</body></html>')
return apache.OK
我已将 hello.py 文件放在 /var/www/html 文件夹中,每当我键入 http://localhost/hello then 404 file not found error comes and when I type extension also in url http://localhost/hello.py 时,hello.py 文件的完整内容就会显示在我的浏览器中。
提前致谢。
看到这个http://webpython.codepoint.net/mod_python_publisher_apache_configuration
或
获取它的简单方法,在您的文件夹中创建文件 .htaccess /var/www/html 并写入文件:
SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On
我正在尝试使用 mod_python 到 运行 python 脚本配置 apache。我尝试了许多不同的配置,但 none 有效。我的 hello.py 文件看起来像这样
from mod_python import apache
def handler(req):
req.log_error('handler')
req.content_type = 'text/html'
req.send_http_header()
req.write('<html><head><title>Testing mod_python</title></head> <body>')
req.write('Hello World!')
req.write('</body></html>')
return apache.OK
我已将 hello.py 文件放在 /var/www/html 文件夹中,每当我键入 http://localhost/hello then 404 file not found error comes and when I type extension also in url http://localhost/hello.py 时,hello.py 文件的完整内容就会显示在我的浏览器中。 提前致谢。
看到这个http://webpython.codepoint.net/mod_python_publisher_apache_configuration
或
获取它的简单方法,在您的文件夹中创建文件 .htaccess /var/www/html 并写入文件:
SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On