Deploying Flask Projects

Deploy Flask applications on Skyversal with Gunicorn. Zero-config setup, environment variables, and troubleshooting guide.

Deploying Flask Projects

With its minimalist, flexible, and powerful design, Flask is an excellent choice for microservices and APIs. Skyversal deploys your Flask projects instantly via Gunicorn without any extra configuration.

Read Time: 4 Minutes
Server: Gunicorn
Standard: WSGI

What you'll learn in this guide

  • Required dependencies (Gunicorn requirement)
  • Application instance (app object) detection logic
  • Environment variables usage
  • Custom entry point (FLASK_APP)

1. Required Dependencies (requirements.txt)

Flask applications need a WSGI server alongside the Flask package to run in production. Make sure your dependency file includes these two packages:

requirements.txt
Flask==3.0.0
gunicorn==21.2.0 # Required as WSGI server
# ... your other dependencies

2. How Is the Flask App Detected?

Skyversal automatically uses Gunicorn to start your Flask project. For Gunicorn to find your application, your code must define app = Flask(__name__).

Skyversal looks for the app object in these files, in order:

  • app.py
  • main.py
  • application.py
  • wsgi.py
💡
Using a Custom File Name? (e.g., server.py)

If your application is in a different file (e.g., server.py), go to the Skyversal panel and add a new variable under Settings > Environment Variables:

Key: FLASK_APP
Value: server:app

3. Environment Variables

You should never hardcode passwords, API keys, or database URLs directly in your Flask application code. You can easily read variables added through the Skyversal panel using os.getenv():

from
flask
import
Flask
import
os

app = Flask(__name__)

# Securely reading the secret key
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'default-insecure-key')
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL')

@app.route('/')
def
hello_world():
    
return
'Hello World from Skyversal!'

Common Errors (Troubleshooting)

Application failed health check

Fix: Gunicorn can't find the app object. Make sure your file name is standard (app.py, etc.) or that you've correctly set the FLASK_APP variable.

ModuleNotFoundError: No module named 'flask'

Fix: Missing requirements.txt at root. Export your dependencies with pip freeze > requirements.txt and push to GitHub.

Port In Use (EADDRINUSE)

Fix: If you have app.run(port=...) at the bottom of your code, it's unnecessary since Skyversal uses Gunicorn. You can safely remove it.

You're Ready! 🚀

Once all checks pass, just push your code. Skyversal will have your SSL-secured Flask app live in seconds.

Last updated on July 29, 2026
Edit this page on GitHub