+/var/www/openweek
| lighttpd.conf
| +/scripts
| | app.py
| +/static
| | +/pages
| | | index.html
| | +/css
| | | index.css
| +/templates
| | temp.html
| +/storage
import web
urls = {"/": "index"}
class index:
def GET(self):
return "Hello World from Python!"
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()
<html>
<head>
<title>{{title}}</title>
</head>
<body>
{% block body %}{% endblock %}
</body>
</html>
{% extends "layout.html" %}
{% block body %}
Hello {{user_name}}
{% endblock %}
class example:
def GET(self):
context = {
"title" : "Example page",
"user_name" : "Billjoy"
}
return render_template("template.html", **context)