How can I render html file in twisted resource in python?

372 views Asked by At

Currently i am doing this

from twisted.web.resource import Resource

class MyPostResource(Resource):
    def render_GET(self, request):
        html_file = open("form.html","rb")
        html_file = html_file.readlines()
        html_file = "\n".join(html_file)
        return html_file

what is the proper way to render a html file in twisted resource in python?

0

There are 0 answers