I have this function:
def run():
if request.method == 'POST':
print(request.form['id_num'])
# fix later
else:
return render_template("apprun.html")
Right now it is always directing to the else statement, but the render_template function is not working correctly. Instead of a fully formatted HTML page, I'm getting the code as if it were a string. Specifically, my webpage is showing the html, instead of reading the html and displaying it properly:
<!DOCTYPE html>
<html>
<head>
<title>Rips Lab</title>
</head>
<body>
<style type="text/css">
html {
background-color: #E4E0EE;
}
body {
font-family: "Helvetica","Arial";
font-size: 20px;
color: #000000;
}
</style>
<form>Enter participant ID number: <input type="number" name="id_num" pattern="^[0-9]*$" required></form>
<br><br>
<p name="data"></p>
</body>
</html>
The folder hierarchy is correct; I have a folder called "templates" stored in the same place as the python file I'm running.
Any idea why it's not formatted correctly?