Flask Hello World

Published 11 Jul, 2020

How to code hello world in python flask web framework. Hello World in Flask Web Application Framework

Flask is the Python framework for building web application. It’s so pupular because of the simplicity. So simple that it doesn’t ship with batteris like ORM. But it has huge collection of third-party libraries. You can use that to create web application without righting lot of codes. Enough of the build up let’s see how easy to create web application in Flask.

from flask import Flask

app = Flask(__name__)

def index():
		return "Hello World"

This is how you write hello wolrd application in Flask. Look at the code it’s so mininal. Not more than 5 lines. You can run this code with wsgi server like gunicorn but flask also ship with CLI tool. To run using flask cli you need to export your app instance like this.

export FLASK_APP=helloworld.py

That’s it now you can issue this command flask run and it will start the development server. And then you can browse localhost ip address in browser.

This article published under development on flask tags. Please subscribe below forms to receive advertisement free articles.

Join the Newsletter

Subscribe to get our latest content by email.
    We won't send you spam. Unsubscribe at any time.