> ## Documentation Index
> Fetch the complete documentation index at: https://www.aptible.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy a Python + Flask Demo App

> Deploy our Python demo app using the Flask framework with Managed PostgreSQL Database and Redis instance

> [card] [Deploy Now](https://app.aptible.com/create)

> [card] [GitHub Repo](https://github.com/aptible/deploy-demo-app)

> [card] [View Example](https://app-60388.on-aptible.com/)

# Overview

The following guide is designed to help you deploy an example app on Aptible. During this process, Aptible will launch containers to run a Python app with a web server, a background worker, a Managed PostgreSQL Database, and a Redis instance.

![](https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/flask1.png?fit=max\&auto=format\&n=2c_c-XH-dAzVOaDu\&q=85\&s=0627d26b6502fbfb650fc62e2ec920c6)

The demo app displays the last 20 messages of the database, including any additional messages you record via the "message board." The application was designed to guide new users through a "Setup Checklist" which showcases various features of the Aptible platform (such as database migration, scaling, etc.) using both the dashboard and Aptible CLI.

# Deploy App

> [!NOTE]
>
> Prerequisite: Ensure you have [Git](https://git-scm.com/downloads) installed.

Using the [Deploy Code](https://app.aptible.com/create) tool in the Aptible Dashboard, you can deploy the **Deploy Demo App**. The tool will guide you through the following:

**1. Deploy with Git Push**

![](https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/flask2.png?fit=max\&auto=format\&n=2c_c-XH-dAzVOaDu\&q=85\&s=fca1202761392674e0e50f2afa05cc8a)

**2. Add an SSH key**

![](https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/flask3.png?fit=max\&auto=format\&n=2c_c-XH-dAzVOaDu\&q=85\&s=230ae34d856b5b3fe8c476c6fe3454c9) If you have not done so already, you will be prompted to set up an [SSH key](https://www.aptible.com/docs/core-concepts/security-compliance/authentication/ssh-keys.md#ssh-keys).

**3. Environment Setup**

![](https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/flask4.png?fit=max\&auto=format\&n=2c_c-XH-dAzVOaDu\&q=85\&s=c1644981d2945b756b24845227c23c8a) Select your [stack](https://www.aptible.com/docs/core-concepts/architecture/stacks.md) to deploy your resources. This will determine what region your resources are deployed to. Then, name the [environment](https://www.aptible.com/docs/core-concepts/architecture/environments.md) your resources will be grouped into.

**4. Prepare the template**

![](https://mintcdn.com/aptible/opX5eNKf32ujRi0n/images/flask5.png?fit=max\&auto=format\&n=opX5eNKf32ujRi0n\&q=85\&s=30672f0cb0672b43d9dd556722399f8d) Select **Deploy Demo App** for deployment, and follow command-line instructions.

**5. Fill environment variables and deploy**

![](https://mintcdn.com/aptible/opX5eNKf32ujRi0n/images/flask6.png?fit=max\&auto=format\&n=opX5eNKf32ujRi0n\&q=85\&s=0d8f624eb8ff7e0914bc352aa9839a37) Aptible will automatically fill this template's app configuration, services, and required databases. This includes: a web server, a background worker, a Managed PostgreSQL Database, and a Redis instance. All you have to do is fill the complete the environment variables save and deploy the code!

Aptible will show you the logs in live time: ![](https://mintcdn.com/aptible/opX5eNKf32ujRi0n/images/flask7.png?fit=max\&auto=format\&n=opX5eNKf32ujRi0n\&q=85\&s=a9ba3734bd9f2ef4c7941d088e7e31ea)

**6. Expose your app to the internet**

![](https://mintcdn.com/aptible/opX5eNKf32ujRi0n/images/flask8.png?fit=max\&auto=format\&n=opX5eNKf32ujRi0n\&q=85\&s=4c34014ede13d2d1448c0654cd975a1d) Now that your code is deployed, it's time to expose your app to the internet. Select the service that needs an [endpoint](https://www.aptible.com/docs/core-concepts/apps/connecting-to-apps/app-endpoints/overview.md), and Aptible will automatically provision a managed endpoint.

**7. View your deployed app**

![](https://mintcdn.com/aptible/opX5eNKf32ujRi0n/images/flask9.png?fit=max\&auto=format\&n=opX5eNKf32ujRi0n\&q=85\&s=541d675b0169b77deef70b1f6ae57ee7)

From here, you can optionally test the application's message board and/or "Setup Checklist."

# Continue your journey

> [card] [Deploy custom code](https://www.aptible.com/docs/custom-code-quickstart.md)
>
> Read our guide for deploying custom code on Aptible.
