File tree Expand file tree Collapse file tree 6 files changed +46
-0
lines changed Expand file tree Collapse file tree 6 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ #coding:utf-8
2+ import web
3+
4+ urls = (
5+ '/' , 'Index'
6+ )
7+
8+ app = web .application (urls , globals ())
9+
10+ render = web .template .render ('templates/' ) # 渲染templates/文件夹下的index
11+
12+ class Index (object ):
13+ def GET (self ):
14+ greeting = "Hello World1"
15+ #return render.index(greeting = greeting # 把greeting变量传递给index网页模板中的greeting
16+ return render .foo (greeting = greeting ) #templates文件夹下创建了一个新的foo.html的模板
17+ if __name__ == "__main__" :
18+ app .run ()
Original file line number Diff line number Diff line change 1+ $def with (greeting)
2+ < html >
3+ < head >
4+ < title > Gothons Of Planet Percal #25</ title >
5+ </ head >
6+ < body >
7+
8+ $if greeting:
9+ I just wanted to say < em style ="color: green; font-size: 2em; "> $greeting</ em > .
10+ $else:
11+ < em > Hello</ em > , world!
12+
13+ </ body >
14+ </ html >
Original file line number Diff line number Diff line change 1+ $def with (greeting)
2+ < html >
3+ < head >
4+ < title > Gothons Of Planet Percal #25</ title >
5+ </ head >
6+ < body >
7+
8+ $if greeting:
9+ I just wanted to say < em style ="color: green; font-size: 2em; "> $greeting</ em > .
10+ $else:
11+ < em > Hello</ em > , world!
12+
13+ </ body >
14+ </ html >
You can’t perform that action at this time.
0 commit comments