Skip to content

Latest commit

 

History

History

mod15-blobstore

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Module 15 - Add usage of App Engine blobstore to webapp2 ndb sample app

This repo folder is the corresponding code to the Module 15 codelab. The tutorial STARTs with the Python 2 code in the Module 0 repo folder and leads developers through adding use of App Engine blobstore, resulting in the code in this folder. Unlike other sample apps, this does not use the default Django templating system, but instead, uses Jinja2, which is supported in webapp2_extras.

Blobstore evolved into Google Cloud Storage, and all blobs/files created using the Blobstore API go into the default Cloud Storage bucket for your project. It's named the same as the appspot domain name given to your app. For example, if your project is named my-project, your default bucket would be my-project.appspot.com. The default GCS bucket name is programmatically accessible via google.appengine.api.app_identity.get_default_gcs_bucket_name().

The primary application file main.py writes files directly to the default bucket. If you want to customize the GCS location where App Engine writes files, see the alternative main-gcs.py file. In that file, the gs_bucket_name parameter is used when calling google.appengine.ext.blobstore.create_upload_url() to specify the bucket/location to write the file.

Unlike some of the other migrations, Blobstore usage depends on webapp (where as the app uses the webapp2 micro framework), so this migration must start at Module 0 rather than Module 1. One update however, is that this sample switches to the Jinja2 templating system from the default Django template system used in Module 0. Jinja2 is supported as an App Engine built-in library and accessed via the webapp2_extras package.