March 2016
Intermediate to advanced
276 pages
6h 48m
English
Now, we'll create a basic web page and serve it using Flask's built-in server to localhost. This means that we'll run a web server on our local machine that we can easily make requests to from our local machine. This is very useful for development but not suited for production applications. Later on, we'll take a look at how to serve Flask web applications using the popular Apache web server.
Our application will be a single Python file. Create a directory in your home directory called firstapp and a file inside this called hello.py. In the hello.py file, we'll write code to serve a web page comprising the static string "Hello, World!". The code looks as follows:
from flask import Flask app = Flask(__name__) ...