Getting Started with Flask Python

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.

Hello world! in Flask Python

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__)

def hello():
    return "Hello World!"
if __name__ == "__main__": language: JavaScript (javascript)

You could also run this application using Flask Command as described in Documentation 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 address and"Hello World!" will appear in browser.


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
%d bloggers like this:
Verified by MonsterInsights