fbpx

How to setup and deploy your Flask application

Flask is a lightweight yet powerful web development framework written in Python. Flask offers a rich set of extensions and tools that can facilitate the management of key web development processes. In this tutorial, we will create a basic Hello World application with Flask. 

Flask requires Python  >= 3.8.

Installing Flask
pip install Flask
Creating a basic Flask application

First, create a file as following:

app.py

from flask import Flask
app = Flask(__name__)

@app.route('/') 
def hello_world():
     return 'Hello, World!'

Next, run it with the following command:

flask run

Now go to your web browser and navigate to 

localhost:5000
Deploying the Flask application

Now that you have successfully created your Flask application, you would want to make it accessible to public. There are various hosting services available for web applications, including serverless container platforms like Vercel, which offer ease of use and scalability, as well as virtual servers like AWS EC2, which provide greater control and customization options.

In the next tutorial we will deploy our app on an AWS EC2 server.

Resources

Leave a Reply

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