跳至内容
Python 俱乐部
用户工具
登录
站点工具
搜索
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您的足迹:
google:gae:request-url
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== 得到request的URL地址 ====== 得到的request的URL地址,我们就可以根据request的URL地址用GAE动态的生成网页内容。 ===== 程序代码 ===== <code python> from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class MainPage(webapp.RequestHandler): def get(self): header = str(self.request) self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, webapp World!\n') self.response.out.write(header) application = webapp.WSGIApplication( [('/.*', MainPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() </code> ===== 访问结果 ===== 访问下面的地址时 %%http://localhost:8080/dfasf%% 可以得到 <code> Hello, webapp World! GET /dfasf Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Language: en-us,en;q=0.5 Connection: keep-alive Content-Length: Content-Type: application/x-www-form-urlencoded Host: localhost:8080 Keep-Alive: 300 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 </code>
google/gae/request-url.txt
· 最后更改: 2010/06/02 01:18 (外部编辑)
页面工具
显示页面
修订记录
反向链接
回到顶部