I’m trying to pass parameter from python page to another through the URL,this parameter(key in my problem)is passed correctly but in the other page i have this code:
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()
but the problem that class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):didn’t execute ,when i ran this code, the output is
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
although the parameter is passed correctly;this is the url and the key(parameter):
http://localhost:8080/download.py?key=vzsX4xM1EtNak5RQVxj4BQ==
EDIT:
This is my app.yaml code:
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
Please i want a solution for this problem ?any suggestions are welcome.
/download.pyisn’t even in yourapp.yaml.How would
webappfind the correct script to run?Concentrating for now on the download script, this is an example of how your
app.yamlshould look:Edit:
Alternatively, you can specify a more-specific regexp-pattern for the download URL:
And the URL would be something like: