This guide assumes you already have a hosted server in place with Flask installed. You can find many tutorials online to get Flask set up.

> **New in 2026 — Managed VPS hosting**: DeployHQ now offers [Managed VPS Hosting](https://www.deployhq.com/hosting/managed-vps) — fully-managed Linux servers with built-in CI/CD. Flask runs cleanly on Managed VPS with gunicorn or uWSGI + Nginx. The walkthrough below covers BYO-server deployment, which remains fully supported.

## Using DeployHQ for Deployments

DeployHQ is a service that simplifies deploying applications to your servers. You can define configurations, custom commands, and automate deployments on pushing code.

The free plan lets you deploy 1 project up to 10 times a day!

### Creating a Project

After signing up and logging in, create a project by going to **Projects** > **New Project**.

Follow the wizard and choose your repository. If you encounter issues connecting, refer to [DeployHQ's support page](https://www.deployhq.com/support/projects/creating-a-project).

### Dedicated User for DeployHQ

For security, it's recommended to create a separate user for deployments:

```bash
sudo adduser deployhq
sudo usermod -a -G www-data deployhq
```

### Configuring a Server

Now, tell DeployHQ where your application resides. Go to **Servers** > **New Server**.

-   Choose a memorable name and select **SSH** as the protocol.
-   Enter your server's IP address in the **Hostname** field.
-   The **Username** should be `deployhq`.
-   Check the **Use SSH key rather than password for authentication?** box. Then, run these commands on your server:

```bash
su - deployhq
mkdir ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
```

-   Paste DeployHQ's public key, press `Ctrl + X`, `y`, then `Enter` to save.
-   Finally, set correct permissions with:

```bash
chmod 600 ~/.ssh/authorized_keys
```

-   Set the **Deployment Path** to where your Flask app resides (e.g., `/var/www/example.com`). Enable **Perform zero-downtime deployments on this server**.

Zero-downtime deployments ensure your previous version stays live until the new one is ready. You can learn more about this process in [DeployHQ's documentation](https://www.deployhq.com/features/zero-downtime-deployments).

By enabling this, your application files will reside in a path like `/var/www/example.com/current`. Update your web server configuration accordingly.

-   Enter `production` in the **Environment** field and enable **automatic deploy**.

Once done, press **Save**.

**Note:** If you have connection issues, refer to [DeployHQ's support page](https://www.deployhq.com/support/common-server-errors).

### Config Files (Optional)

DeployHQ allows uploading files during deployment that you don't want in your repository (like `.env` files containing sensitive data).

Go to **Config Files** and click **New Config File**.

In your project, open the `.env.example` file and copy its contents into the config file content field.

### Setting Up SSH Commands

We'll configure commands to execute on the server after deployment.

Go to **SSH Commands** and click **New SSH Command**.

Create the following commands:

-   **Install Dependencies:**

```bash
cd %path% && pip install -r requirements.txt
```

-   **(Optional) Run Migrations:**

If you use Flask-Migrate, add this command:

```bash
cd %path% && flask migrate
```

Commands run sequentially, so ensure they're in the correct order.

### Deploying Your Project

That's it! Time to deploy.

Click **Deploy Project** in the header. The created server and revisions should be preselected. Once everything looks good, click **Deploy** to begin deployment.

Now you've automated your Flask project deployments!

If you've got any other projects you'd like to automate deployments for, we've written lots of [guides for deploying the most popular application frameworks and content management systems](/guides).