Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python创建简单网站时出现模板错误_Python_Python 2.7_Web.py - Fatal编程技术网

使用python创建简单网站时出现模板错误

使用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> <

我使用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>
</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”
$问候语