Deploy a Flask App


You can deploy a Flask application on Render in just a few clicks.

A sample app for this quick start is deployed at https://flask.onrender.com. The code uses Gunicorn to serve your app in a production setting.

  1. Fork render-examples/flask-hello-world on GitHub. This is the content of the app we’re deploying, from a minimal Flask application in the official docs:

    from flask import Flask
    app = Flask(__name__)
    
    @app.route('/')
    def hello_world():
       return 'Hello, World!'
  2. Create a new Web Service on Render, and give Render’s GitHub app permission to access your new repo.

  3. Use the following values during creation:

    EnvironmentPython
    Build Commandpip install -r requirements.txt
    Start Commandgunicorn app:app

That’s it! Your web service will be live on your Render URL as soon as the build finishes.

Going forward, every push to your GitHub repo will automatically build your app and deploy it in production. If the build fails, Render will automatically stop the deploy process and the existing version of your app will keep running until the next successful deploy.