我在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()
答案 0 :(得分:0)
我通过在static
文件夹中添加.htaccess文件解决了问题:
SetHandler None