- templates ディレクトリを作成し、そこに index.html を作る
Example 2. index.html$def with (name) $if name: I just wanted to say hello to $name. $else: <em>Hello</em>, world!
- test01.py を作成
Example 3. test01.py# -*- coding:utf-8 -*- import web urls = ( '/', 'index' ) app = web.application(urls, globals()) render = web.template.render('templates/') class index: def GET(self): name = 'Bob' return render.index(name) if __name__ == "__main__": app.run()
- 実行
> python test01.py
0 件のコメント:
コメントを投稿