Deploy a Streamlit App to Streamlit Community Cloud (2026)

Deploy a Streamlit App to Streamlit Community Cloud (2026) Web Engineer

Streamlit Community Cloud is Streamlit's official free hosting for Streamlit apps stored on GitHub. Put streamlit_app.py and requirements.txt in a repository, click "Create app" on share.streamlit.io, choose the repository, branch and file, and within a few minutes the app is live at your-app.streamlit.app. This guide walks through the deployment with a sample app that I actually ran locally, then covers choosing a Python version, handling secrets.toml, free-tier resource limits and sleep, the private-app limit, and how Community Cloud compares with Render (checked against the official docs in December 2026).

What Streamlit Community Cloud is, and its free-tier limits

Streamlit Community Cloud (formerly Streamlit Cloud / Streamlit Sharing) is hosting dedicated to Streamlit apps, run by Streamlit (part of Snowflake). There is no server to configure, and pushes to GitHub show up in the app almost immediately. It costs nothing, but it comes with these limits:

ItemWhat the official docs say
CPUMin 0.078 cores / max 2 cores
MemoryMin 690MB / max 2.7GB
StorageUp to 50GB
SleepApps with no traffic for 12 hours go to sleep. A visitor clicks "Yes, get this app back up!" to wake it
Private appsOne at a time
URLA your-app.streamlit.app subdomain (customizable, 6–63 characters)
Updates from GitHubUp to 5 per minute
Hosting regionUnited States only (cannot be changed)
Operating systemDebian 11 (bullseye)
Deploy permissionYou need admin access to the repository

The CPU, memory and storage figures are listed in the docs as approximate values "as of February 2024", and the docs state they may change without notice. When an app exceeds its memory limit, viewers see "Oh no." and the developer sees "This app has gone over its resource limits." Apps that load a large machine-learning model or a CSV of several hundred MB on every run hit this limit easily.

Some tutorials say apps sleep after one hour, but as of December 2026 the official docs say apps sleep after 12 hours without traffic. Anyone who can view a sleeping app can wake it with one click; they don't have to be the developer.

Before you deploy

You need three things:

  • A GitHub account and a repository for the app (public or private)
  • A Streamlit Community Cloud account (share.streamlit.io)
  • A Streamlit app that you have already run locally

You can sign in to Community Cloud with a one-time code sent by email, "Continue with Google" or "Continue with GitHub". Signing in with GitHub does not yet grant access to your repositories, so after signing in you connect GitHub from your workspace. Because you need admin access to the repository you deploy, fork someone else's repository into your own account first if you want to deploy it.

Build the sample app and run it locally

The example is a small app that charts sales over time from a number of days and a growth rate. So that you can also check that secrets work, it reads a greeting from st.secrets. I ran it on Python 3.12 with Streamlit 1.68.0 while writing this article.

Folder structure

my-streamlit-app/
├── streamlit_app.py
├── requirements.txt
├── .gitignore
└── .streamlit/
    └── secrets.toml   ← local only, never pushed to GitHub

streamlit_app.py

import numpy as np
import pandas as pd
import streamlit as st

st.set_page_config(page_title="Sales Simulator", page_icon="📈")
st.title("Sales Simulator")
st.caption("Sample app for deploying to Streamlit Community Cloud")

# Read from secrets.toml (in the cloud: Secrets in Advanced settings)
greeting = st.secrets.get("greeting", "Secrets are not set")
st.info(greeting)

days = st.slider("Days", min_value=7, max_value=90, value=30)
growth = st.number_input("Daily growth rate (%)", value=1.5, step=0.5)

rng = np.random.default_rng(seed=0)
base = 100 * (1 + growth / 100) ** np.arange(days)
sales = base + rng.normal(0, 5, days)
df = pd.DataFrame(
    {"Sales": sales.round(1)},
    index=pd.date_range("2026-12-01", periods=days, name="Date"),
)

st.metric("Sales on the last day", f"{df['Sales'].iloc[-1]:,.1f}", f"{growth}% / day")
st.line_chart(df)

with st.expander("Show data"):
    st.dataframe(df, width="stretch")

I first wrote st.dataframe(df, use_container_width=True), but Streamlit 1.68.0 logged a deprecation warning at runtime saying that use_container_width should be replaced with width (scheduled for removal after 2025-12-31). Code copied from older tutorials triggers this warning, so use width="stretch".

requirements.txt

streamlit==1.68.0
pandas
numpy

Community Cloud has almost no libraries preinstalled, so list every package you import. Pinning Streamlit to the same version you use locally cuts down on "works locally, breaks in the cloud" problems.

.streamlit/secrets.toml and .gitignore

# .streamlit/secrets.toml
greeting = "Hello! Loaded from secrets.toml"
# .gitignore
.streamlit/secrets.toml
__pycache__/
.venv/

Run it locally

python -m venv .venv
source .venv/bin/activate   # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
streamlit run streamlit_app.py

Open http://localhost:8501 in your browser and you should see something like the screenshot below, which I took after starting the app while writing this article. If the string from secrets.toml appears in the blue box, secrets are loading correctly.

The Streamlit sample app (sales simulator) running locally, with a slider, a metric and a line chart
The sample app running locally on Streamlit 1.68.0 (the screenshot shows the original Japanese UI strings). The "Deploy" button in the top right also takes you to the Community Cloud deploy screen

Push to GitHub

Create a new repository on GitHub and push your local files. secrets.toml is excluded by .gitignore, so it will not end up in the repository.

git init
git add streamlit_app.py requirements.txt .gitignore
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/<your-username>/my-streamlit-app.git
git push -u origin main

After pushing, always check on GitHub that .streamlit/secrets.toml is not in the repository. If you accidentally push an API key, deleting the file is not enough: revoke (rotate) the key with its issuer.

Where each file goes: streamlit_app.py, requirements.txt, packages.txt and .gitignore go to GitHub; .streamlit/secrets.toml stays local and its contents are pasted into Secrets on Community Cloud
Files you push to GitHub, and the file you keep local and paste into the cloud's Secrets field instead

Deploy to Streamlit Community Cloud step by step

The official docs describe these steps:

  1. Open your workspace on share.streamlit.io and click "Create app" in the upper-right corner
  2. When asked "Do you already have an app?", choose "Yup, I have an app."
  3. Enter the repository, branch and main file path (for example streamlit_app.py). You can also use "Paste GitHub URL" and just paste the file's URL on GitHub
  4. (Optional) Enter a custom subdomain in the "App URL" field
  5. (Optional) Open "Advanced settings", pick a version from the "Python version" dropdown, paste the contents of secrets.toml into the "Secrets" field, and click "Save"
  6. Click "Deploy". Most apps are up within a few minutes
Deploying to Streamlit Community Cloud: test locally, push to GitHub, specify the repository in Create app, then Deploy to publish at your-app.streamlit.app
Four steps from local testing to push, Create app and Deploy. After launch, every push updates the app
Community Cloud Advanced settings dialog with a Python version dropdown and a Secrets field in TOML format
Advanced settings (Python version and Secrets). Source: Deploy your app on Community Cloud (Streamlit Docs)

While it deploys, the build log scrolls on screen, and the app appears once the dependencies are installed. From then on, every push to GitHub updates the app automatically. Changes to requirements.txt or packages.txt trigger a reinstall of packages, so they take longer than ordinary code changes.

How the App URL (subdomain) is chosen

If you leave App URL blank, the URL is generated in this format:

https://[GitHub username or org]-[repo name]-[app path]-[branch name]-[short hash].streamlit.app

The branch name is omitted when it is main or master. The result is long and hard to remember, so if you plan to share the app, set a custom subdomain such as sales-simulator.streamlit.app. You can change it after deployment too, under "App URL" on the "General" tab of App settings, within 6–63 characters. Names already in use or containing restricted words are not allowed. The official docs do not describe any way to attach your own custom domain, so the URL is always a streamlit.app subdomain.

Python version and dependency files

Choosing the Python version

You choose the Python version at deploy time with "Python version" in Advanced settings. The official deployment page gives 3.12 as the default. Only release versions that still receive security updates are offered, and apps on versions that reach end of life may be upgraded automatically.

There is no setting to change the Python version after deployment. To change it, delete the app and redeploy it with the same repository, branch, file and subdomain, choosing the new version in Advanced settings. Deleting the app also deletes its secrets, so copy them somewhere first (the subdomain can be reused right after deletion).

The docs also recommend developing with the same Python version you deploy on. A mismatch, such as 3.13 locally and 3.12 in the cloud, can make individual packages fail to install.

Supported dependency files and their priority

Formats other than requirements.txt are supported too. If several files exist, only the first one found in this order is used:

PriorityFileTool
1uv.lockuv
2Pipfilepipenv
3environment.ymlconda
4requirements.txtpip (processed with uv where possible)
5pyproject.tomlpoetry

Files are searched for first in the directory of the main file, then in the repository root. The docs ask you to keep only one dependency file, so avoid situations like a uv-managed project with a stale requirements.txt left behind. The wrong file may take priority, and packages you expect will be missing.

System packages via apt (packages.txt)

If you need OS-level packages, such as for OpenCV or extra fonts, put a packages.txt in the repository root with one Debian package name per line. The environment runs Debian 11 (bullseye), so look package names up in the bullseye package list.

# packages.txt example (a Japanese font)
fonts-ipafont-gothic

Setting secrets (API keys and more)

Keep API keys and database passwords out of your code and manage them as secrets. The format is the same TOML locally and in the cloud.

EnvironmentWhere secrets live
Local.streamlit/secrets.toml (a global ~/.streamlit/secrets.toml in your home directory also works; the project file takes precedence)
Community Cloud (at deploy time)Advanced settings → paste into the "Secrets" field
Community Cloud (after deploying)In your workspace, the app's "⋮" menu → "Settings" → "Secrets" tab, edit and click "Save"

Your code reads secrets like a dictionary. Sections ([tables]) let you group things like database connection details.

# secrets.toml
OPENAI_API_KEY = "sk-xxxx"

[db]
host = "example.com"
user = "app"
password = "xxxx"
import os
import streamlit as st

api_key = st.secrets["OPENAI_API_KEY"]      # access by key
host = st.secrets.db.host                   # attribute access inside a section
same_key = os.environ["OPENAI_API_KEY"]     # root-level keys are also environment variables

Keys at the root level are also exposed as environment variables, so libraries that read from os.environ (such as the OpenAI SDK) pick them up as is. To handle a missing key gracefully, use st.secrets.get("key_name", default) as in the sample app.

Managing the app after deployment (logs, reboot, private apps)

Viewing logs and rebooting

With the app open, click "Manage app" in the lower-right corner to see the Cloud logs. They almost always show the cause of an error. If the app hangs after running out of memory, choose "Reboot" from the app's menu in your workspace or from the Cloud logs menu to clear memory and restart it.

Making an app private

Apps deployed from a public repository are public and searchable by default. To show an app only to specific people, open "Share" in the upper-right corner, change "Who can view this app" to "Only specific people can view this app", enter the viewers' email addresses and click "Invite". Invited viewers sign in with Google OAuth if their email is tied to a Google account, or otherwise with a single-use link sent by email.

However, you can have only one private app at a time. To deploy a second private app, you have to make the existing private app public or delete it. If you need to run several internal tools, look at options other than Community Cloud (such as Render, covered below, or Streamlit in Snowflake).

Common errors and fixes

SymptomLikely causeFix
ModuleNotFoundErrorThe package is missing from the dependency file, or a different file takes priorityList every imported package. Keep only one dependency file
Package installation failsDifferent Python versions locally and in the cloudRedeploy with the same version as local (delete and recreate)
KeyError / secrets not foundSecrets not set in the cloudPaste them into Settings → "Secrets" and save
"This app has gone over its resource limits."Memory limit exceededLoad data and models once with @st.cache_data / @st.cache_resource, read fewer rows and columns, Reboot
Errors such as libGL.so.1 (OpenCV)The GUI build of OpenCV needs system librariesUse opencv-python-headless, or add the required packages in packages.txt
Repository does not appear in the listGitHub connection lacks permission, or you are not an admin of the repositoryReview the GitHub connection. Fork other people's repositories

For errors that happen on Render, see Render deploy errors and how to fix them.

Community Cloud vs Render: which should you deploy to?

Streamlit apps can also be deployed to Render, a general-purpose PaaS. The steps are in How to deploy a Streamlit app on Render. Here is how the two free tiers compare as of December 2026:

ItemStreamlit Community CloudRender (Free instance)
PriceFreeHobby plan $0 + Free instance $0
CPU / memory0.078–2 cores / 690MB–2.7GB0.1 CPU / 512MB
SleepSleeps after 12 hours without traffic. Wake with a buttonSpins down after 15 minutes without traffic. Starts automatically on the next request, taking about a minute
Monthly limitsNone stated750 Free instance hours, 5GB bandwidth, 500 build minutes (per workspace)
What you can runStreamlit appsAny web app (Python, Node.js, etc.), Docker
Setup effortJust pick the fileBuild Command / Start Command (with the port) required
URLyour-app.streamlit.appyour-app.onrender.com; custom domains supported (up to 2 on Hobby)
Private accessOne app, by email invitationNo viewer-invitation feature; implement authentication in the app if needed
DatabaseNone (use an external service)Free Postgres (1GB, expires 30 days after creation)
Community Cloud sleeps after 12 hours without traffic and wakes with a button; Render Free spins down after 15 minutes and takes about a minute to start on the next request. Memory: up to 2.7GB vs 512MB
How each free tier stops, and memory compared (December 2026)

For a portfolio or analytics dashboard built entirely in Streamlit, Community Cloud is the better fit: almost no setup and more memory headroom. If you want a custom domain, need to pair the app with another service such as FastAPI, or want the database in the same place, Render is the candidate. Keep in mind that Render's free instance has only 512MB of memory and spins down after 15 minutes, so visitors will often wait for it to start.

Summary

  • Push streamlit_app.py and requirements.txt to GitHub and point "Create app" on share.streamlit.io at them to publish
  • Choose the Python version in Advanced settings at deploy time. Changing it later means deleting and redeploying
  • Keep secrets.toml off GitHub; in the cloud, paste its contents into the Secrets field
  • The free tier gives up to about 2.7GB of memory, sleeps after 12 hours without traffic, and allows one private app
  • If you need a custom domain or a database, Render is an option (its free instance spins down after 15 minutes)

References

Title and URL copied