Edit

Quickstart: Create and deploy a Python web app to Azure by using an azd template

This quickstart guides you through the easiest and fastest way to create and deploy a Python web and database solution to Azure. By following the instructions in this quickstart, you:

  • Choose an azd template based on the Python web framework, Azure database platform, and Azure web hosting platform you want to build on.
  • Use CLI commands to run an azd template to create a sample web app and database, and create and configure the necessary Azure resources. Then, deploy the sample web app to Azure.
  • Edit the web app on your local computer and use an azd command to redeploy.
  • Use an azd command to clean up Azure resources.

It should take less than 15 minutes to complete this tutorial. When you finish, you can start modifying the new project with your custom code.

To learn more about these azd templates for Python web app development, see:

Prerequisites

An Azure subscription - Create one for free

Install the following tools on your local computer:

Choose a template

Choose an azd template based on the Python web framework, Azure web hosting platform, and Azure database platform you want to build on.

  1. Select a template name (first column) from the following list of templates in the following tables. Use the template name during the azd init step in the next section.

    Template Web Framework Database Hosting Platform GitHub Repo
    azure-django-postgres-flexible-aca Django PostgreSQL Flexible Server Azure Container Apps repo
    azure-django-postgres-flexible-appservice Django PostgreSQL Flexible Server Azure App Service repo
    azure-django-cosmos-postgres-aca Django Cosmos DB (PostgreSQL Adapter) Azure Container Apps repo
    azure-django-cosmos-postgres-appservice Django Cosmos DB (PostgreSQL Adapter) Azure App Service repo
    azure-django-postgres-addon-aca Django Azure Container Apps PostgreSQL Add-on Azure Container Apps repo

Run the template

Running an azd template is the same across languages and frameworks. The same basic steps apply to all templates. The steps are:

  1. At a terminal, navigate to a folder on your local computer where you typically store your local git repositories. Create a new folder named azdtest. Then, change into that directory by using the cd command.

    mkdir azdtest
    cd azdtest
    

    Don't use Visual Studio Code's Terminal for this quickstart.

  2. To set up the local development environment, enter the following commands in your terminal and answer any prompts:

    azd init --template