1

I was creating a simple website using web.py framework . But when i ran the website it gave template error.

My html file code

def with (greeting)
<html>
<head>
<title> "This is a web project"</title>
<body>
<H1>"Yoyo honey singh"</H1>
<H6>greeting<H6>
</body>
</head>
</html>

My python file code

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()

I placed the index.html file in the template folder and the python script in the bin folder. The directory structure is like

D:\WEBSITE WEBSITE NAME init.py bin app.py tests init.py docs templates

1 Answer 1

1

According to the documentation you should put a $ before each python statement in the template. Therefore the first file becames:

$def with (greeting)
<html>
<head>
<title> "This is a web project"</title>
<body>
<H1>"Yoyo honey singh"</H1>
<H6>$greeting<H6>
</body>
</head>
</html>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.