使用python创建简单网站时出现模板错误
我使用web.py框架创建了一个简单的网站。但当我运行该网站时,它给出了模板错误 我的html文件代码使用python创建简单网站时出现模板错误,python,python-2.7,web.py,Python,Python 2.7,Web.py,我使用web.py框架创建了一个简单的网站。但当我运行该网站时,它给出了模板错误 我的html文件代码 def with (greeting) <html> <head> <title> "This is a web project"</title> <body> <H1>"Yoyo honey singh"</H1> <H6>greeting<H6> </body> <
def with (greeting)
<html>
<head>
<title> "This is a web project"</title>
<body>
<H1>"Yoyo honey singh"</H1>
<H6>greeting<H6>
</body>
</head>
</html>
import web
urls = ("/","Index")
app = web.application(urls,globals())
render = web.template.render("\templates")
class Index:
def GET(self):
greeting = "HELLO WORLD"
return render.index(greeting = greeting)
if __name__ == "__main__":
app.run()
我将index.html文件放在模板文件夹中,将python脚本放在bin文件夹中。目录结构如下
D:\网站
网站
名称
init.py
箱子
app.py
测验
init.py
文件
模板根据,应该在模板中的每个python语句之前放置一个$
。因此,第一个文件是:
$def with (greeting)
<html>
<head>
<title> "This is a web project"</title>
<body>
<H1>"Yoyo honey singh"</H1>
<H6>$greeting<H6>
</body>
</head>
</html>
$def with(问候语)
“这是一个web项目”
“Yoyo honey singh”
$问候语