Deploy a Flask app in Azure web app through Visual Studio code

Photo by Tim Dennert on Unsplash

This post will walk you through steps for creating and deploying a Flask web app in the Azure app services.

Step 1: Create a basic app in the flask

First, let us create a minimal flask app for illustrating the steps for publishing an app in the Azure app services.
Create a python file app.py with the below code.

Create the requirements.txt file and add the libraries needed for the project.

Flask>=1.0,<=1.1.2

You can find the sample project for the same in the Github link.

Step 2: Sign-in into azure in Visual studio code.

Before we proceed with this step, I assumed that you have an Azure account and subscriptions linked to that account. You can access your Azure resources through the Azure portal.

To access Azure services from visual studio code, go to extension at the sidebar and search for Azure App Service and click install. It will add all the required dependencies to the visual studio code.

Once added, you will see APP Services in the side menu bar in visual studio code, as shown in the below figure.

Now sign in to Azure using your Microsoft account. Once signed in, you will see the list of subscriptions you have under your account.

Step 3: Creating an azure app

Click on the subscriptions where it will prompt for creating a new web app.

You can start providing the details like web app name, resource group, pricing tier, python version, etc., needed for creating an app.

Once all the relevant details are provided, an azure web app will be created below your subscription.

Step 4: Deploying into Azure web app.

To deploy this app, you can select Deploy to the web app. This will prompt you to select the folder that contains your flask project which you want to deploy.

Once selected, the deployment process starts. After the deployment completes, you can view the web page by selecting the Browse website option in the Azure app you have deployed.

I hope this gives you an overview of deploying app from visual studio code.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Diagram of Every Type of Ballscreen/Pick-and-Roll

Drown into programming because of a street light pole 🚨

ARM and leg for NativeAOT

Easy way to debug and externalize logs from CloudWatch when log events are more

101 On Aerospike Data Base for Beginners

Hello-World in Apache NiFi

Spring Boot Semantic Versioning

Create and deploy a flask API in Heroku (Part 2)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sachinjose

Sachinjose

More from Medium

Fundamentals of REST API

Django ORM(Object–relational mapping) ‘OR’ and ‘AND’ query

Creating a basic REST API using Flask

How To Execute SQL Server Stored Procedure From Python?