Setup simple python-flask-project

Setup a Basic Flask Project

Hola! Let’s start building a Basic Flask app

In Future, we are gonna make this blog post as a part of Blog Series called as Flask Microservice 101.

Step 1 : Install basic Python project Requirement

Before starting anything if you have never-ever work with python. then your system also may not have python and pip install, so first installed them by follow the link below:

Step 2 : Install python virtualenv for local development environment

virtualenv is used to manage Python packages for different projects. Virtualenv –

pip3 install virtualenv

Step 3 : Basic Flask Project Setup

We’ll start with a basic “Hello World” app on flask

For the initial setup, you should have to install the following tools: Python3 , pip3 and Virtualenv. First things first, let’s get a working directory set up: First things first, let’s get a working directory set up:

mkdir basic-flask && cd basic-flask
git init //optional

Set up a virtual environment to use for our application:

python3 -m venv myflaskenv
source myflaskenv/bin/activate
  • In order to leave your virtual environment, run deactivate, and then run source env/bin/activate when you want to work on your project again.

Next we’re going to get our basic structure for our app set up. Add the following files to your “flask-by-example” folder:

touch requirements.txt
  • we can also create .gitignore file

Install Flask

python3 -m pip install Flask==1.1.2
python3 -m pip freeze > requirements.txt

Open up in your favorite editor and add the following code:


from flask import Flask
app = Flask(__name__)

def hello():
    return "Hello World!"

if __name__ == '__main__':

Run the app:


you should see your basic “Hello world” app in action on http://localhost:5000/. Kill the server by ctrl+c when you are done.