I have a simple Python program called main.py.
It looks like this :
import stuff
def execute():
print("some stuff")
Now, I wanted the output of this file to be displayed on a webpage
So, I made a Flask File :
from flask import Flask, render_template
import main
app = Flask(__name__)
@app.route('/')
def script_output():
output = main.execute()
return render_template('template_name.html',output=output)
if __name__ == '__main__':
app.run()
And this is the template_name.html file :
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Trial</title>
</head>
<body>
<p></p>
</body>
</html>
Why is the Webpage sowing a value of None and still printing to the Python console? How do I correct it /
Aucun commentaire:
Enregistrer un commentaire