Let's first take a look at a Python Flask example:
- Navigate to the flask directory in chapter-10 (cd flask).
- You'll need to install a few pieces for our setup. These instructions are for Python:
- Create a virtual environment with python3 -m venv env.
- Activate it using . env/bin/activate.
- Install the requirements: pip3 install -r requirements.txt.
- Now you can start the application: python3 app.py.
- Access the page at http://localhost:5000. You'll see this:
Figure 10.2 – Basic Flask application
Play around with entering and not entering your name and take a look at the fact that the page reloads when you do so (I've added a timestamp to make it easier to see as the page reload can happen too quickly to see). This is a very basic Flask application, and there are more efficient ways to do validation work with a combination of Python and JavaScript, but at a base level, even with some Flask-based form validation tools, the validation and interaction...