home ~ projects ~ socials

Render A Template String In Python's flask Web Server

#!/usr/bin/env python3

from flask import Flask
from flask import render_template_string

app = Flask(__name__)

@app.route('/')
def index():
    return render_template_string("""
<!DOCTYPE html>
<html><head><title>CSS Test</title></head>
<body>Example output: {{ the_text }}</body>
</html>""",
                                  the_text="alfa")


app.run(port=8100, host='0.0.0.0')
-- end of line --