Book Image

Mastering Google App Engine

Book Image

Mastering Google App Engine

Overview of this book

Table of Contents (18 chapters)
Mastering Google App Engine
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Serving static resources


We are making progress. From strings to templates, but still no cosmetics. Just plain HTML is what we are serving. However, to add some beautification to the pages, we will have to style it. To style the pages better, we will need style sheets, and style sheets might need images to beautify our pages This means that we have to serve static files as well.

Serving static files is pretty simple. You just need to add a handler in your app.yaml file as usual, but instead of the script node, you need to add a static_dir node, which indicates the directory in which the files that you want to serve are present. Let's modify our earlier app to serve some static files such as style sheets and images:

- handlers:
  - url:/assets/.*
    static_dir: assets

You may have already guessed that any URL that starts with /assets will be handled by this handler. However, instead of invoking a script, it maps itself to a directory called assets, which is located at the root of your application...