April 2017
Beginner to intermediate
312 pages
7h 23m
English
The Flask framework documentation explains building the first example. Modify the example from the documentation as follows:
#!/usr/bin/python3from flask import Flaskapp = Flask(__name__)@app.route("/")def hello(): return "Hello World!"if __name__ == "__main__": app.run('0.0.0.0')
Launch this example (available for download along with this chapter as flask_example.py) and it should launch a server on the Raspberry Pi Zero visible to the network. On another computer, launch a browser and enter the IP address of the Raspberry Pi Zero along with port number, 5000, as a suffix (as shown in the following snapshot). It should take you to the index page of the server that displays the message Hello World!:
Read now
Unlock full access