EthioDeploy
DocsPricingDomainsBlogToolsChangelog
Deploy guides/Streamlit

Deploy a Streamlit app

Streamlit deploys from requirements.txt like any Python app. Set one start command that passes $PORT to --server.port, move secrets into env vars, and push. WebSockets work without extra setup.

Last updated November 17, 2026

What we run by default
Detected by
requirements.txt, pyproject.toml or Pipfile
Install
pip install -r requirements.txt (or poetry / uv / pdm)
Build
none by default
Start
python main.py (set streamlit run)

These run automatically, so leave the command fields blank. Only override them in Settings → Build if you need something different.

Fix this first: Pass $PORT to --server.port; Streamlit ignores PORT

Streamlit listens on 8501 unless you tell it otherwise, and it doesn't read the PORT variable we set. The app starts fine, the log shows port 8501, and the deploy fails with “The app never answered on port $PORT”. Set the Start command in Settings → Build to streamlit run app.py --server.port $PORT --server.address 0.0.0.0.

Prepare your app

  1. List streamlit and everything your script imports in requirements.txt:
    streamlit
    pandas
    plotly
  2. Set the Start command in Settings → Build, using your entry file's name:
    streamlit run app.py --server.port $PORT --server.address 0.0.0.0
    A Procfile with the same command after web: works too.
  3. Pin the Python version with a .python-version file, for example 3.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

  1. Sign in with GitHub and install the EthioDeploy app on the repo.
  2. Click “New Project” and pick the repo.
  3. 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

LaravelRailsExpress

All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.

On this page
Prepare your appSecrets and environment variablesAdd a databaseUploaded and generated filesHealth checkHost a Streamlit app for freeDeployTroubleshootingQuestions
Deploying with an agent?Point it at llms.txt. Every guide is in one file there.Open llms-full.txt →
EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiDjangoFastAPIFlaskStreamlitExpressNestJSLaravelRailsGoTelegram botDiscord botLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy