Boilerplate setup for App Engine with html5-boilerplate 2.0, OpenID, memcache, user preferences, and more
App Engine Boilerplate is a versatile yet minimalistic setup for new App Engine projects.
BaseRequestHandler
for simplified rendering and access to user preferences@login_required
decoratoris_testenv()
and slugify(url)
app.yaml
configuration for admin areas, static filesThis project does not contain a lot of code. To get the best understanding of it's features we recommend to simply browse through the files! You can see a rather minimalistic live version here.
User authentication with OpenID works out of the box, including a nice user interface via the [openid-selector] 1 jQuery plugin (also used by [stackoverflow] 2). Be sure to enable OpenID authentication in your app settings on app engine.
More infos about appengine and openid:
Returning cached data usually improves the performance of a website. App Engine provides a custom version of memcache to store various data types, which can be used to efficiently cache the results of datastore queries, or commonly used elements on the homepage.
app/mc/cache.py
contains an exemplary method of querying data from
memcache with a datastore fallback if not yet cached. Simply adapt as you need it!
[html5 boilerplate] 1 is a great base setup for building the website frontend, and furthermore includes a build script which minifies and compresses html, css, javascript and images.
html5-boilerplate is located in /static_dev
, and it's build script outputs an optimized release version to /static_dev/publish
.The only modification to the standard html5-boilerplate is adding a few blocks to /static_dev/index.html
: {% block header|main|scripts|footer %}
During development the symlink /static
points to /static_dev
. On publishing
the project upload_to_appengine.sh
invokes the html5-boilerplate build script
and changes the symlink /static
to /static_dev/publish
, in order to upload
the optimized version.
upload_to_appengine.sh
is a tiny shell script which simplifies invoking the html5-boilerplate build tools before testing and uploading your app to app engine. To use it you need to set CMD_APPCFG
to your local dev_appserver.py
.
Exact steps of ./upload_to_appengine.sh
:
ant minify
These would be the manual steps:
# go into html5-boilerplate's build directory
$ cd static_dev/build
# run ant, which compiles an optimized version into static_dev/publish
$ ant minify
# go back into the main directory
$ cd ../../
# change reference of /static symlink to optimized version
$ rm static
$ ln -s static_dev/publish static
# Test the optimized version
# Publish to web with appcfg.py
# After publishing you can change back to static_dev
$ rm static
$ ln -s static_dev static
CSS files are no longer imported from index.html
but exclusively through using
@import
in style.css.
html5 boilerplate automatically includes, minifies and concatenates css files
which are imported via an @import
statement from within style.css
. Add
references to your custom stylesheets from there, never from within index.html.
There are a couple of posix symlinks within the project that will need to be updated to work with Windows.
To create the new links, delete the existing links and use the mklink command from an command prompt run with Administration privileges.
Making these two changes will enable you to launch the project using the Google App Engine SDK Launcher. During deployment the current .sh script changes the /static link to /static_dev/publish and a forthcoming .bat script will include this functionality.
Feedback, improvements and critique are greatly appreciated. Fork away!
Some ideas for future improvements: