3 July 2010

This tutorial shows how to use Cascading Style Sheets in Google AppEngine. It's all about url mapping. You have to have some basic setup of a project to follow this tutorial.

Files and folders:

These are the files that are used in this tutorial to show how to get the style sheets to template, with pretty url.
Source code viewer
  1. static/css/style.css
  2. templates/index.html
  3. app.yaml
  4. index.py
Programming Language: Text

app.yaml:

The style sheet file is in static/css folder, but we would like to have url that looks like http://www.example.com/css/style.css. So we need to use handlers for the url.
Source code viewer
  1. application: project_name
  2. version: 1
  3. runtime: python
  4. api_version: 1
  5.  
  6. handlers:
  7. - url: /css
  8.   static_dir: static/css
  9.  
  10. - url: /.*
  11.   script: index.py
Programming Language: YAML
Now you know how to create Cascading Style Sheets in your Python project on Google AppEngine. You can use the same principle on images(img folder), JavaScript files(js folder), etc...