在Google App Engine(Python)中的RequestHandler之外获取请求uri [英] Get the request uri outside of a RequestHandler in Google App Engine (Python)

查看:146
本文介绍了在Google App Engine(Python)中的RequestHandler之外获取请求uri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在webapp.RequestHandler子类中,我会使用 self.request.uri 来获取请求URI。但是,我无法访问RequestHandler外的所有内容,因此无法访问。任何想法?



我正在运行Python,而且我和GAE一样新。

解决方案

您通常应该在某种RequestHandler或非WebApp框架中的相应内容中执行所有操作。然而,如果你坚持坚持在20世纪90年代早期停滞并编写简单的CGI脚本,那么环境变量SERVER_NAME和PATH_INFO可能就是你想要的;有关更多信息,请参阅CGI参考。


So, within a webapp.RequestHandler subclass I would use self.request.uri to get the request URI. But, I can't access this outside of a RequestHandler and so no go. Any ideas?

I'm running Python and I'm new at it as well as GAE.

解决方案

You should generally be doing everything within some sort of RequestHandler or the equivalent in your non-WebApp framework. However, if you really insist on being stuck in the early 1990s and writing plain CGI scripts, the environment variables SERVER_NAME and PATH_INFO may be what you want; see a CGI reference for more info.

这篇关于在Google App Engine(Python)中的RequestHandler之外获取请求uri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆