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

Is Scrum Agile Enough?

Firebase. Facebook sign-in method

Basics of HTML-1

API Security — Request/ Response Validation using API Manager

Let’s talk about sex*

Pushing data into Cosmos DB using spark data frame

OOP Concepts in Java

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

VSCode create Big Data Maven/Java Project on WSL2 Ubuntu on Windows

Read and Write Data in Google Sheets using Python and the Google Sheets API

How to enable Linter in Visual Studio Code — Python

How To Install SQL Server on Docker