Mod_Python需要每个文件的Python Handler吗?

时间:2012-04-23 23:27:48

标签: python mod-python

使用 mod_python ,我想知道为什么我必须创建 PythonHandler 才能获得解析Python代码的URL。如果您在下面看到,如果我没有名为jrpython.py的文件,它将无法正常工作。

有没有办法让我的所有.py 文件只运行而不是每次都添加?

<VirtualHost *:80>
   DocumentRoot /var/www/vhost/testsite.com
   ServerName www.testsite.com

  <Directory "/var/www/vhost/testsite.com">
        AddHandler mod_python .py
        PythonHandler jrpython
        PythonDebug On
        Options FollowSymLinks
        AllowOverride All
        Order Allow,Deny
        Allow From All
  </Directory>
</VirtualHost>

1 个答案:

答案 0 :(得分:1)

当然,你可以让mod_python运行你的.py文件而不必全部命名。您仍然需要指定PythonHandler,但可以是Publisher handler