3 Jul, 2010This 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.
static/css/style.css
templates/index.html
app.yaml
index.py
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
application: project_name
version: 1
runtime: python
api_version: 1
handlers:
- url: /css
static_dir: static/css
- url: /.*
script: index.py
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
application: project_name
version: 1
runtime: python
api_version: 1
handlers:
- url: /css
static_dir: static/css
- url: /.*
script: index.py
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
application: project_name
version: 1
runtime: python
api_version: 1
handlers:
- url: /css
static_dir: static/css
- url: /.*
script: index.py
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...