Link with 1 note
I just forked tipfy on bitbucket and committed a bunch of changes that I make every time I start a new project. This includes a base jinja template that is derived from h5bp.com’s settings, and a crapload of mimetypes added to app.yaml, taken from h5bp’s server-config repository.
The hello_world.html has been updated to inherit from h5bp.html, to give an example of how to use template inheritance.
h5bp’s build script is included, which minifies css and js files, with modifications to work with the default app configuration.
And to make it more user-friendly I added an Apache Ant build.xml script to simplify some common tasks.
First, install Apache Ant. If you’re running a Mac or Linux you probably already have it. Then download or clone the repot and go into the “app/project” directory using terminal or a command prompt. Type ant setup and it should download and install all the extensions needed to run tipfy (takes a few minutes).
After that’s done you can type ant compile-publish and the script will create a publish directory, minify your css and js scripts, optimize your images (if you have optipng and jpegtran installed), compile your templates, and leave you with a publish directory that you can upload to App Engine. Pre-compiling templates is usually an optional step that speeds up page rendering. Normally templates are dynamically compiled when they are viewed.
You can also type ant deploy-publish and it will do all of the above AND upload it to App Engine (after prompting you for email and password). Note: don’t make any changes you want to keep in the publish directory. It gets deleted and recreated every time you run “deploy-publish”.
ant deploy-dev will just upload the working app directory, without any minification or compilation.
In “build/config” there are a couple of property files that you can use to customize the behavior of the build scripts. Should be self explanatory, but might require some experimentation. Paul Irish has a video walkthrough of the build script that explains what it does and some of what these config files can do.
If you’ve been curious about App Engine, or Python web development, I highly recommend tipfy.