【发布时间】:2012-04-12 07:36:29
【问题描述】:
我正在尝试通过 URL 将参数从 python 页面传递到另一个页面,这个参数(我的问题中的关键)被正确传递但在另一个页面中我有这个代码:
from google.appengine.ext import blobstore
from google.appengine.ext import webapp
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp.util import run_wsgi_app
import urllib
import urllib2
class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):
def get(self):
blob_key = self.request.get('key')
blob_key = str(urllib.unquote(blob_key))
blob_info = blobstore.BlobInfo.get(blob_key)
self.send_blob(blob_info)
def main():
application = webapp.WSGIApplication(
[('/',ServeHandler),], debug=True)
run_wsgi_app(application)
if __name__ == '__main__':
main()
但是类ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):没有执行的问题,当我运行这段代码时,输出是
Status: 404 Not Found
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 0
虽然参数传递正确;这是url和key(参数):
http://localhost:8080/download.py?key=vzsX4xM1EtNak5RQVxj4BQ==
编辑: 这是我的 app.yaml 代码:
application: myapplication
version: 1
runtime: python
api_version: 1
handlers:
- url: /compress.py
script: compress.py
- url: /download.py
script: download.py
- url: /decompress.py
script: decompress.py
- url: (.*)/
static_files: static\1/index.html
upload: static/index.html
我想要这个问题的解决方案吗?欢迎提出任何建议。
【问题讨论】:
-
你的
app.yaml是什么样的? -
亲爱的上帝,伙计;请将该信息添加到您的问题中(编辑)
-
@bernie:好的,我会编辑问题。
标签: python google-app-engine blobstore python-2.5