title: Display blob image in template Google App Engine (Python)
body: <p><strong>I am trying to display an uploaded blob image.  It seems to be storing ok, but won't display on the html template when called.  Even seems to be showing up in the logging.  When looking at other examples, the only real difference I see is you have to iterate over a list, but really just want to pull only one picture.   Any advice you can give is greatly appreciated. -Thanks</strong></p>
  
  <p><strong>Handlers:</strong></p>
  
  <pre><code>class PictureHandler(BaseHandler2):
  def get(self, **kwargs):
      user_session = self.user
      user_session_object = self.auth.store.get_session(self.request)
  
      user_info = models.User.get_by_id(long( self.user_id ))
      user_info_object = self.auth.store.user_model.get_by_auth_token(
          user_session['user_id'], user_session['token']) 
  
      user = self.session.get('user') 
  
      uploads = db.GqlQuery("SELECT * FROM UserPictureUpload WHERE user =:1 ORDER BY created DESC", user_info.username).get()
  
      upload_url = blobstore.create_upload_url('/upload')
  
      params = {
      'upload_url': upload_url,
      'user': user_info.username,
      'uploads': uploads      
      }       
  
      return self.render_template('picture.html', **params)
  
  
  class UploadHandler(blobstore_handlers.BlobstoreUploadHandler, BaseHandler2):
  def post(self):
      user_session = self.user
      user_session_object = self.auth.store.get_session(self.request)
  
      user_info = models.User.get_by_id(long( self.user_id ))
      user_info_object = self.auth.store.user_model.get_by_auth_token(
          user_session['user_id'], user_session['token']) 
  
      user = self.session.get('user') 
  
      title = self.request.get('title')
      pic = self.request.get("picfile")   
  
  
      if pic:
          picture = db.Blob(pic)
  
      upload = UserPictureUpload(title = title, picture=picture, user=user_info.username)         
      upload.put()
      self.redirect('/settings/picture')  
  
  
  class ViewHandler(blobstore_handlers.BlobstoreDownloadHandler, BaseHandler2):
  def get(self):    
      user_session = self.user
      user_session_object = self.auth.store.get_session(self.request)
  
      user_info = models.User.get_by_id(long( self.user_id ))
      user_info_object = self.auth.store.user_model.get_by_auth_token(
          user_session['user_id'], user_session['token']) 
  
      user = self.session.get('user') 
  
  
      upload_key_str = self.request.params.get('key')
  
      if upload_key_str:              
  
          upload = db.get(upload_key_str)
          if upload:
              logging.info('** Upload Found** --  %s' % upload.picture)  
  
          self.send_blob(upload.picture)      
  
  
      if not upload_key_str:
  
          self.error(404)
          return 
  </code></pre>
  
  <p><strong>Routing</strong>:</p>
  
  <pre><code>RedirectRoute('/settings/picture', handlers.PictureHandler, name='picture', strict_slash=True), 
  RedirectRoute('/upload', handlers.UploadHandler, name='upload', strict_slash=True), 
  RedirectRoute('/view', handlers.ViewHandler, name='view', strict_slash=True)
  </code></pre>
  
  <p><strong>Html:</strong>   </p>
  
  <pre><code>&lt;form action="{{ upload_url }}"  method="post" enctype="multipart/form-data"&gt;
  &lt;label for="title"&gt;Title:&lt;/label&gt;
  &lt;input type="text" id="title" name="title" /&gt;&lt;br /&gt;
  &lt;label for="upload"&gt;File:&lt;/label&gt;
  &lt;input type="file" id="upload" name="picfile" /&gt;&lt;br /&gt;
  &lt;input type="submit" value="Upload Picture" /&gt;
  &lt;/form&gt;
  &lt;br /&gt;
  &lt;img src='/view?key={{uploads.key()}}' alt='no image'/&gt;&lt;/img&gt;
  </code></pre>
  
  <p><strong>App Engine Log:</strong></p>
  
  <p>INFO     2013-07-30 16:11:20,946 handlers.py:875] ** Upload Found** --  Content-Type: image/jpeg</p>
  
  <p>Content-Length: 775702</p>
  
  <p>Content-MD5: NWE0NGM3YmE1YmJlNGVjODY3MjMzZDY3ZTQ4MDY4NDg=</p>
  
  <p>content-disposition: form-data; name="picfile"; filename="Jellyfish.jpg"</p>
  
  <p>X-AppEngine-Upload-Creation: 2013-07-29 15:41:00.481000</p>
  
  <p>INFO     2013-07-30 11:11:21,005 server.py:584] default: "GET /view?key=ag5kZXZ-c2FuZGVuZ2luZXIeCxIRVXNlclBpY3R1cmVVcGxvYWQYgICAgJjxtgsM HTTP/1.1" 200 -</p>