app.py 代码如下:
import web
urls = ('/','Index')
db = web.database(dbn='sqlite',db='movesite.db')
app = web.application(urls,globals())
render = web.template.render('templates/')
class Index:
def GET(self):
movies = db.select('move')
return render.index(‘movies’)
if __name__ == '__main__':
app.run()
INDEX.HTML 代码如下:
$def with (movies)
<html>
<head>
<meta charset="UTF-8">
<title>hello world</title>
</head>
<body>
<h1>豆瓣movies</h1>
$movies['name']
</body>
</html>
页面发生错误, 提示indexError
我估计错误的代码在? $movies['name']
怎么调用数据库传输的数据呢?
import web
urls = ('/','Index')
db = web.database(dbn='sqlite',db='movesite.db')
app = web.application(urls,globals())
render = web.template.render('templates/')
class Index:
def GET(self):
movies = db.select('move')
return render.index(‘movies’)
if __name__ == '__main__':
app.run()
INDEX.HTML 代码如下:
$def with (movies)
<html>
<head>
<meta charset="UTF-8">
<title>hello world</title>
</head>
<body>
<h1>豆瓣movies</h1>
$movies['name']
</body>
</html>
页面发生错误, 提示indexError
我估计错误的代码在? $movies['name']
怎么调用数据库传输的数据呢?