Hello, I have a very simple question I hope. I know python, but I'm brand new to using it with flask on the web. My flask_app.py has:
from flask import Flask
from homepage import homepage
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def a():
content = homepage()
return content
... and my homepage.py has:
from flask import request
form = """
<form method="post" action="/">What is your name?<input type="text" name="name"><input type="submit"></form><br>
"""
def homepage():
name = ""
if request.method == 'POST':
name = request.form['name']
name = "Your name is " + name + "."
return form + name
My question is, how can I store the variable name in memory without: 1. Creating a database 2. Passing it with a <form> post/get
Is there any way to store them globally even after clicking through a link to another .py file.
Maybe cookies? Maybe something simpler that just exists in Flask?
Thank you!