Hardware Reference
In-Depth Information
Engage thrusters
1.
The Flask framework is installed using the following command:
sudo easy_install flask
2.
Once the installaion is complete, we will use an example available from the
Flask framework documentaion ( http://flask.pocoo.org/docs/0.10/
quickstart/#quickstart ) and create a Python script (using Python
IDLE's editor):
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
3. When we execute the saved file and execute the Python script, the web server is
launched locally on the Raspberry Pi:
python helloworld.py
* Running on http://127.0.0.1:5000/
4. The web server is only visible to the Raspberry Pi and a web page (web address:
http://127.0.0.1:5000 ) is launched on the Raspberry Pi's browser, which
will show the text Hello World! .
An Hello World example on the Flask framework-based web server
5.
In order to make the web server visible to all devices on the local network, we need
to change the following line in the Python script:
app.run('0.0.0.0')
Objective complete - mini debriefing
In this task, we are done installing the Flask framework for controlling the framework.
We will move on to the next task to set up things.
 
Search WWH ::




Custom Search