2013-02-26 33 views
4

在Flask中,有没有办法让request.path包含WSGI或其他可能添加的任何“装饰”?request.path和url_for在Flask下不匹配mod_wsgi

在测试模式(只在端口5000)运行,我request.pathurl_for('settings')搭配得很好,但一旦WSGI下,如预期,我url_for('settings')变得/manage/settings/,但request.path yeilds /settings/

我在我的httpd.conf中有以下内容,并且正致力于将开发中的application移至活动网站。

WSGIScriptAlias /manage /sw/servermanager/servermanager.wsgi 
WSGIDaemonProcess servermgr user=user group=grp threads=4 
<Directory /sw/servermanager> 
    WSGIProcessGroup servermgr 
    WSGIApplicationGroup %{GLOBAL} 
    WSGIScriptReloading On 
    Order deny,allow 
    Allow from all 
</Directory> 

我喜欢让模板非常通用,然后使用CSS即时显示导航信息的想法。我已经使用this answer中提供的技术来构建我对此的观点,但是当我将mod_wsgi添加到等式中时会出现问题。

我环顾了请求对象,除了可能使用url_rule之外没有看到我想要的那么多,但是然后参数回避了我。

只是良好的措施,为WSGI脚本的链接,我使用:https://github.com/FernFerret/servermanager/blob/master/servermanager.wsgi

我也很想为request对象的文档中,我发现我的方式围绕它通过使用内置在调试器和help(request)

编辑:我应该说,这个url不匹配Apache下运行的mod_wsgi。

回答

相关问题