By Abdul Rehman
Flask is a micro-framework in Python for developing web applications. Flask supports jinja2 template engine. We will use Flask framework for developing our mini (sometimes major) IoT based Applications in Raspberry PI. Because of it’s REST like request handling system it become very easy to develop APIs and/or web clients/server like applications. Flask is very easy to use. Easy to get start with and have complete documentation with lot’s of examples available over internet.
Flask could be easily installed via PIP package manager from command line with as simple as this
pip install Flask
A simple Hello World Application with Flask framework could be very simple with few lines of code like this
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run()
You could also run this application using Flask Command as described in Documentation
FLASK_APP=hello.py flask run
Now if you are running this in Raspberry Pi like in our case then enter IP-Address of your Raspberry PI in browser with http://192.168.43.102:5000/ address and
"Hello World!" will appear in browser.
FYP Solutions Powered By Impressive Business WordPress Theme