.htaccess& web.py,在SetHandler fcgid-script之后保留对静态文件夹的访问

时间:2014-06-23 18:08:49

标签: python .htaccess web.py

我在root中使用以下.htaccess来启动web.py应用程序:

allow from all
SetHandler fcgid-script
Options +ExecCGI
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.py/$1 [PT]

除了我无法使用css等访问静态文件夹之外,一切正常。

这是app.py中的代码:

import web
from getImgUrl import search

render = web.template.render('templates/')

urls = (
  '/', 'index'
)

class index:
    def GET(self):
        term = search()
        return render.index(term[0], term[1])

web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
if __name__ == "__main__": 
    app = web.application(urls, globals())
    app.run()  

1 个答案:

答案 0 :(得分:0)

我通过在static文件夹中添加.htaccess文件解决了问题:

SetHandler None