Deploy Flask to Render
Tags: webdev, flask, deployment, opensource
Published: 2022-10-10 10:42:51

---
title: Deploy Flask to Render
published: true
description: Learn how to Go LIVE with Flask using the Render Platform
tags: webdev, flask, deployment, opensource
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfnikyyf8jiaeqff9t0i.jpg
canonical_url: https://docs.appseed.us/deployment/render/flask
---
Hello Coders!

This article explains how to go live with a [Flask project on Render](https://docs.appseed.us/deployment/render/flask), a popular deployment platform. For newcomers, `Render` supports the deployment for all major languages, Free Certificates, DDoS protection, and auto deploys from GitHub. 

> *Thanks for reading!* Here are the covered topics:

- ✅ Create a new Render Account
- ✅ Link the project to be deployed from GitHub
- ✅ Edit project information
- ✅ Update the runtime environment 
- ✅ Trigger a manual build
- ✅ At the end, mention the VIDEO version: 
  - [Deploy Flask to Render](https://youtu.be/jWxYzKVkcwY), published on YouTube

In case the above topics sounds interesting, we can move on and find out, `step-by-step`, how to deploy a simple Flask project to Render. 

--- 

## ✨ Render Account Creation

The Sign UP is provided via classic Email and Social Authentication for well-known providers like GitHub, GitLab, or Google. Once the sign-up process is finished, the user is redirected to the dashboard. 

![Flask Render Deployment - Sign UP page.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mzwfjeas7h7co9zd7qi8.png)

---

## ✨ Create a new project

All projects that use a dynamic language during runtime (Python, NodeJs) should be created as web services. This option can be found in the navigation bar, as shown below: 

![Flask Render Deployment - Creat Web Service](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csl86bjjxqjg68iyflrh.png)

---

## ✨ Link GitHub Repository

The next step is to associate a Flask project with the newly created web service. Render support account linkage with external platforms like GitHub, GitLab, and BitBucket. In our demonstration, an open-source repository is used as a working sample.

> 👉 [Flask & Stripe - Mini eCommerce](https://github.com/app-generator/sample-flask-stripe) (MIT License) 

![Flask Render Deployment - Target Project (mini eCommerce app.)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvvvtk24grd527xtqori.png)

---

> 👉 Here is the Render UI that allows the project association with the web service 

![Flask Render Deployment - Associate Repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dc663lh43fy0m4sagmbw.png)

---

## ✨ Edit project settings

Before going LIVE, we need to configure the future web service. Here is the information required by Render:

- ✅ The `name of the project` (mandatory)
- ✅ The `ROOT` of the project (leave it blank)
- ✅ `Environment`: for a `Flask` project, we should select Python
- ✅ `Region`: only if the location of the server is relevant
- ✅ `Source Branch`: the main branch is used
- ✅ `Build Command`: a simple [BASH script](https://github.com/app-generator/sample-flask-stripe/blob/master/build.sh) is used
- ✅ Start Command: the entry point, usually managed by [Gunicorn](https://gunicorn.org/)

---

A `visual representation` of the above settings used to deploy the project can be found below: 

![Flask Render Deployment - Project Settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4k0co42zzzfkmluf8n0q.png)

---

**The next step** is to specify the `billing plan` for the project. Render platform, at the moment this material is edited, provides a free plan only for static sites built with React, Vue, Next, and all other frameworks.

---

The last step in this tutorial is to expand the "Advanced" section and provide a few `Environment variables` required by **Flask and the Stripe** feature.

- ✅ `DEBUG` Flag: False (the recommended value in production)
- ✅ `SECRET_KEY` variable: used to sign session secrets
- ✅ `SERVER_ADDRESS`: Used by Stripe to redirect after a payment
- ✅ `Stripe Secrets`: PRIVATE and PUBLIC keys (provided by Stripe) 

![Flask Render Deployment - App Environment Variables.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mk8rhwmbrxf6aforgvpx.png)

---

An important aspect of the build is the **automatic deployment** that is enabled by default. In this sample, a manual build is used, just to have full control over the deployment flow.

![Flask Render Deployment - Auto-Deploy Option.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57zh06o36ehe4ks26wzc.png)

---

## ✨ Trigger Manual Deployment

The LIVE version of the project can be updated and even rollbacked anytime with ease via the UI. Here are the steps required by the LIVE update:

- ✅ `Access Manual Deploy` Option
- ✅ Select `Deploy a specific commit`
- ✅ `Add the commit HASH` to be used (provided by Github)
- ✅ `Confirm/select` the commit
- ✅ `Confirm the action` and trigger the deploy

---

> 👉 **Step #1** - Select Specific Deployment Option  

![Flask Render Deployment - Manual Deploy (Step 1)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jso4jddhm5pzth1hu218.png)

---

> 👉 **Step #2** - Select the GitHub commit to deploy 

![Flask Render Deployment - Manual Deploy, Select Commit](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5eib6e4ok5iddkuwn7lb.png)

Once the Render platform starts the build, the state of the web service is flagged as "IN Progress" and soon the updated version should be LIVE.

--- 

## ✨ [Flask & Render](https://www.youtube.com/watch?v=jWxYzKVkcwY) `video presentation`

All the above steps are explained using a video material published on YouTube. 

{% embed https://youtu.be/jWxYzKVkcwY %}

---

> `Thanks for reading!` For more resources, feel free to access: 

- 👉 Deployment [support](https://appseed.us/support/) provided by [AppSeed](https://appseed.us/)
- 👉 [Render](https://render.com/) - the official platform documentation