Creating Your First Flask Application

This time we will cover the steps to create a new development environment for Python and the Flask web development framework. We will create our first Flask application and we will learn how to configure custom routing rules inside Flask.

Flask is a micro framework used for website and Web API development. Being a micro framework means it has a simple core and it is easily extendable. You will see it is very easy and fast to create applications using Flask.

Now, let’s get started.

Install flask
Make sure you already installed python. If not, go to to install it. Then using pip to install Flask.

pip install flask

Create a python file
In your working directory, create a python file. I name it (any filenames also ok). And write this snippet inside it.

from flask import Flaskapp = Flask(__name__)# This is the custom [email protected]('/')def index():    return 'Halo Flask.'@app.route('/about')def about():    return 'About Me''', debug=True)

Now, you can run your first flask application using:


It will run at your localhost using port 5000 as defult port.

Check it in your browser:


Done. It’s easy and simple, isn’t it?

Next, we will cover to make web API with Flask. Stay Tune!

See also  Add Google Adsense to Ghost Blog

About wahyuway

Check Also

The Best Python IDE for Beginners

Every programmers need to hone their skill from scratch. Most Python programmers start to learn …

Leave a Reply