Flask hello world
Flask a web framework that can be used to build web apps with Python.
It’s very minimalist and lightweight, great for making a SaaS app.
Related course: Python Flask: Make Web Apps with Python
First install Flask, you can do so with pip.
Once installed copy the file below and save as web.py
from flask import Flask
Python will show:
# python web.py
This means you have a web server running on port 81.
Open your web browser and type http://127.0.0.1:81/hello
This will show you the hello world message.
We defined the route (‘/hello’) and mapped it to a function:
If you leave it blank you’ll have the index route.