Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:40:28+00:00 2026-06-13T18:40:28+00:00

The instructions from Google about dynamically serving images with GAE are here: https://developers.google.com/appengine/articles/python/serving_dynamic_images The

  • 0

The instructions from Google about dynamically serving images with GAE are here: https://developers.google.com/appengine/articles/python/serving_dynamic_images
The only problem is that this method does not use AJAX, and I don’t think it is as efficient as I would expect.

I am trying to use AJAX with GAE Python 2.7 to serve multiple images dynamically, but I am focusing on serving one right now.

Python Server Side Code:

class GetImage(webapp2.RequestHandler):
    def get(self):
        problem = Problem.all()[0]
        if(problem and problem.prompt_image):
            self.response.headers['Content-Type'] = "image/png"
            self.response.out.write(problem.prompt_image)

Client Side AJAX Code:

$.ajax({
    url: "/img",
    type: "POST",
    dataType: "html",
    success: function(msg){
        $("#right").append("<img>"+msg+"</img>");
    }
});

The problem that I am facing is that I don’t know how to serve the blobstore contents via AJAX to the DOM. Can anyone point me in the right direction?

Thanks!

Edit: voscausa’s solution seems to be on the right track. However, it requires a blob_key. My model is as follows:

class Problem(db.Model):
    prompt_image = db.BlobProperty()

I can’t seem to figure out how to get the Blob Key from the db.BlobProperty. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:40:28+00:00Added an answer on June 13, 2026 at 6:40 pm

    This problem gave me a real headache. Thanks to everyone, especially voscausa who put me on the right path to getting the solution. There is a lot of old material out there, this is the solution I used:
    https://developers.google.com/appengine/docs/python/blobstore/overview#Uploading_a_Blob
    (see complete sample application)

    import os
    import urllib
    import webapp2
    
    from google.appengine.ext import blobstore
    from google.appengine.ext.webapp import blobstore_handlers
    
    class MainHandler(webapp2.RequestHandler):
      def get(self):
        upload_url = blobstore.create_upload_url('/upload')
        self.response.out.write('<html><body>')
        self.response.out.write('<form action="%s" method="POST" enctype="multipart/form-data">' % upload_url)
        self.response.out.write("""Upload File: <input type="file" name="file"><br> <input type="submit"
            name="submit" value="Submit"> </form></body></html>""")
    
    class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
      def post(self):
        upload_files = self.get_uploads('file')  # 'file' is file upload field in the form
        blob_info = upload_files[0]
        self.redirect('/serve/%s' % blob_info.key())
    
    class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):
      def get(self, resource):
        resource = str(urllib.unquote(resource))
        blob_info = blobstore.BlobInfo.get(resource)
        self.send_blob(blob_info)
    
    app = webapp2.WSGIApplication([('/', MainHandler),
                                   ('/upload', UploadHandler),
                                   ('/serve/([^/]+)?', ServeHandler)],
                                  debug=True)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed all of the instructions so far from: http://code.google.com/p/appengine-jruby/wiki/RunningRails and http://gist.github.com/268192 Currently, I'm
I am new to development. I followed step by step instructions from http://code.google.com/apis/maps/articles/flashmapinwpf.html to
I'm trying to use the latest Google NaCl SDK. Following the instructions at https://developers.google.com/native-client/pepper18/devguide/tutorial
I'm trying to follow the instructions at https://developers.google.com/accounts/docs/OAuth2UserAgent in order to log in with
I have followed these instructions: https://developers.google.com/console/help/#generatingdevkeys/ . I registered the freebase service and added
I’ve set up a private NuGet Gallery from github.com/NuGet/NuGetGallery using instructions from here: http://dotnet.dzone.com/news/how-set-local-nuget-gallery
I am analyzing the repo script from Google (instructions at http://source.android.com/source/downloading.html ) The repo
While trying to follow the python-libmemcached instructions at http://code.google.com/p/python-libmemcached/ I run into trouble at
Below are the only instructions I managed to find from Google on how to
I've followed the instructions from http://www.lucidimagination.com/blog/2009/03/09/nutch-solr/ Had solr up and running before that, could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.