In Python I would like to render a python variable "myVariable" - which is already in my workspace - to an html template with flask. I just want to render one single html page to copy paste the source code and publish that on a webserver elsewhere. My code renders local variables but I cannot find a solution for passing workspace variables to the render function.
My template (home.html):
<html>
<head>
<title>Some title</title>
</head>
<body>
<p>My variable = {{ myVariable }}. </p>
</body>
</html>
My python code:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def somfun():
#myVariable = 12345 #**working... but how to use already existing workspace variable?**
return render_template("home.html", myVariable=myVariable)
if __name__ == '__main__':
app.run()
myVariabledefined?sys.argv? I don't know which workspace you're referring to.