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: ...

Get Mastering Google App Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.