Prepare your app
- List
streamlitand everything your script imports inrequirements.txt:streamlit pandas plotly
- Set the Start command in Settings → Build, using your entry file's name:A Procfile with the same command after
streamlit run app.py --server.port $PORT --server.address 0.0.0.0
web:works too. - Pin the Python version with a
.python-versionfile, for example3.12. Current Streamlit (1.67) needs Python 3.11 or newer, and 3.11 is what you get without the file.
You don't need --server.headless true: Streamlit turns headless mode on by itself on a Linux server with no display. Optionally add a .streamlit/config.toml to keep settings in the repo instead of on the command line:
[server] address = "0.0.0.0" [browser] gatherUsageStats = false
Keep --server.port $PORT in the Start command either way. The port changes per deploy, so it can't live in the file.
Secrets and environment variables
st.secrets reads .streamlit/secrets.toml, which belongs in .gitignore, so it isn't there after a deploy from GitHub. Put API keys in the project's env vars instead and read them with os.environ:
import os import streamlit as st api_key = os.environ["OPENAI_API_KEY"]
Env vars are available while the app runs, and a change takes effect on the next deploy. See Environment variables.
Add a database
Add a Postgres addon and DATABASE_URL is injected automatically. It uses the postgres:// scheme, which SQLAlchemy 2.x rejects, so rewrite it before connecting. With st.connection (add sqlalchemy and psycopg[binary] to your requirements):
import os
import streamlit as st
url = os.environ["DATABASE_URL"].replace("postgres://", "postgresql+psycopg://", 1)
conn = st.connection("db", type="sql", url=url)
df = conn.query("select * from orders order by created_at desc limit 100", ttl=60)
st.dataframe(df)ttl caches the result for 60 seconds, so every rerun and every visitor doesn't hit the database again.
Uploaded and generated files
Files from st.file_uploader arrive in memory, which is fine. Anything your app writes to disk is lost on the next deploy, because each deploy starts a fresh container. Keep data you need in the database. Streamlit caps uploads at 200 MB by default; lower it with server.maxUploadSize on the Free plan, where one large file can use most of the app's memory.
Health check
Streamlit answers / with 200, so the default health check path works. It also has /_stcore/health, which returns ok without loading the page, if you'd rather point the Health Check Path in Settings at that.
Host a Streamlit app for free
The Free plan costs nothing and needs no card. It includes:
- One project, live over HTTPS at
<project-slug>.ethiodeploy.app. - 256 MB of memory and half a CPU core.
- A managed Postgres, MySQL or Redis addon with 512 MB of storage. It doesn't expire.
- A redeploy on every push, the same as the paid plans.
The catch is sleep. After 30 minutes without traffic the app stops, and the next request starts it again. We hold that request for up to 30 seconds while the app boots, so the first visitor after a quiet spell waits a little.
Streamlit runs your whole script for every visitor and keeps each session's state in memory, so memory is the limit to watch. A dashboard over a modest dataframe fits in 256 MB. Load data once with @st.cache_data and models or clients once with @st.cache_resource instead of on every rerun. Apps that load PyTorch or a transformers model need Pro.
One Streamlit detail affects sleep. After the page loads, a tab talks to the server over one WebSocket, and we count activity from requests, which for a WebSocket means when it closes. On an app nobody else is visiting, a single session that runs past 30 minutes can be cut off when the app goes to sleep. Reloading the page wakes it again.
When the app has to stay awake or needs your own domain, Pro is $10 or 1,399 ETB a month: always on, 1 GB of memory and a 5 GB database.
Deploy
- Sign in with GitHub and install the EthioDeploy app on the repo.
- Click “New Project” and pick the repo.
- Watch the build in the dashboard. When the health check passes, your app is live at
<project-slug>.ethiodeploy.app. Every push to the default branch redeploys, and the old version keeps serving until the new one is healthy.
Troubleshooting
The app never answered on port $PORT (log says port 8501)
Cause: Streamlit doesn't read PORT and fell back to 8501.
Fix: Add --server.port $PORT to the Start command.
The deploy starts python main.py and exits, or fails the health check
Cause: No Start command, so the Python default ran instead of streamlit run.
Fix: Set the Start command to streamlit run app.py --server.port $PORT --server.address 0.0.0.0.
StreamlitSecretNotFoundError: No secrets found
Cause: secrets.toml isn't in the repo, so st.secrets is empty in production.
Fix: Move the values to env vars and read them with os.environ.
Can't load plugin: sqlalchemy.dialects:postgres
Cause: SQLAlchemy 2.x doesn't accept the postgres:// scheme.
Fix: Rewrite it to postgresql+psycopg:// as shown above.
The app restarts while someone is using it on the Free plan
Cause: Data or a model loaded per session pushed it past 256 MB.
Fix: Cache shared data with st.cache_data/st.cache_resource, or move to Pro for 1 GB.
Still stuck? Check the deployment's build log in the dashboard, or see Troubleshooting.
Questions
Yes. The Free plan runs one project with a 512 MB Postgres database at no cost. The app sleeps after 30 minutes without traffic and wakes on the next request, and the container has 256 MB of memory, enough for a dashboard over a modest dataset. Pro ($10/month) is always on with 1 GB.
streamlit run app.py --server.port $PORT --server.address 0.0.0.0, with your entry file in place of app.py. Streamlit doesn't read the PORT variable, so --server.port is required.
Yes. Streamlit's browser connection is a WebSocket, and it works through the platform's proxy without any setting.
secrets.toml shouldn't be committed, so it isn't in the deployed app. Set the values as env vars in the project's settings and read them with os.environ.
Yes, on Pro and above. The Free plan serves the app at <project-slug>.ethiodeploy.app over HTTPS.
Ready to deploy?
Sign in with GitHub and pick your repo. No Dockerfile, no YAML.
More guides
All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.