Flask

Making Python-based web apps with Flask

Introduction

Flask is a framework for creating webapps in Python. There are other frameworks for Python, Django being one of the most popular. The advantage of Flask is that it is easy for beginners; the “Hello, World” webapp is a single file (see below.

Hello World in Flask

These five lines of code (with one blank line) set up a webserver on your local machine at the web address http://localhost:5000. Each time you request the default page for the site, i.e. /, you get back the message Hello, World:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

To try this code:

Deployment

The following is true of webapps written in Python using Flask:

Tutorial information about Flask

Some tutorial information is available at these links. Eventually I’d like to migrate some of this into this website directly: