I am just playing with python script (test.py) there is one function test1()
.
def test1():
return '<button (code ... for one simple button) .... ></button>'
In my init.py:
from flask import Flask
from flask import render_template, url_for
import test
abc = test.test1()
app = Flask(__name__)
@app.route("/")
def index():
try:
return render_template('index.html', something=abc)
except Exception as e:
return str(e)
if __name__ == '__main__':
app.run()
In my index.html I have:
<body>
{{something}}
</body>
Why html doesn't consider this variable as a code? If i copy <button (code ... for one simple button) .... ></button>
to index.html directly and i just call reneder_template(index.html), everything is fine, however if i call this string from test.py html acts this is pure text within body tags... is there a way to fix this? Would appreciate it. Bascially, i would like html to read this string as a code not as a text.