Learning To Build a Python Flask Web Application
Flask is an open-source and light weight web app framework. It’s one of the more popular frameworks for python developers. The key advantages with this framework is that it’s modular, meaning that we are able to add complexity as we see fit. For example, if we need forms we could just import WTForms to help us build forms and manipulate them.
Getting Started:
Note: The following is taken from https://github.com/pallets/flask’s README.md file.
pip install -U FlaskAfter installing we can then create a new python file called ‘hello.py’ and paste the following:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"Then we can go into our command line and type the following:
$ export FLASK_APP=hello.py
$ flask run
* Running on http://127.0.0.1:5000/It’s as simple as that!
I built a sample project to get familiar with Flask. Please check it out here: https://github.com/KennyMiyasato/imdb_scraper
Resources to get started with developing your Flask web app:
Flask official docs — https://flask.palletsprojects.com/en/1.1.x/
Very helpful user guide: https://flask-doc.readthedocs.io/en/latest/
Corey Schafer’s Full Flask youtube playlist— https://www.youtube.com/playlist?list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH