Skip to main content
Getting an application running on Fly.io is essentially working out how to package it as a deployable image. Once packaged, it can be deployed to the Fly.io platform. In this guide we’ll learn how to deploy a Streamlit application on Fly.io. Streamlit turns data scripts into shareable web apps in minutes. All in pure Python. No front‑end experience required. Spinning up a streamlit app takes no time at all!

Speedrun

First, install flyctl, the Fly.io CLI, and sign up to Fly.io if you haven’t already. The fastest way to get a basic Streamlit server on Fly.io is to use our streamlit template:

Deploy a Streamlit from scratch

For managing our project, we use Poetry. For more information on the initial setup with poetry, refer to setting up a python environment. We can initialize a new project like so:
If you’re using Poetry 2.0+ (the default when installed via pipx), the poetry shell command is no longer built in. Use poetry run to run commands (e.g., poetry run python main.py), or activate the environment with poetry env activate. See the initial setup guide for more details.
Then we have to add the streamlit dependency:
Now, let’s create a simple streamlit app in main.py:
We can then serve the development version of the app using the streamlit cli tool:
This will display a ‘hello from fly.io!’ message when you visit the root URL. Before deploying, we must add a bit of configuration to .streamlit/config.toml:
This ensures that our app doesn’t give a prompt when we ship it. And with that you can deploy the app!
This will generate a fly.toml file with the configuration for your app and a Dockerfile that uses multi-stage builds. Refer to the fly.toml docs for more configuration options. To deploy a new version of your app, simply run fly deploy in the project directory. You can check out the full (yet minimal) example in this GitHub repository for a reference.