Overview
Streamlit Cloud is a platform specifically designed for deploying Streamlit applications. It offers:Free Hosting
Host public apps at no cost
Automatic CI/CD
Deploy automatically from GitHub commits
Easy Setup
No server configuration required
Built-in Monitoring
Access logs and performance metrics
The live demo of Python Arcade Suite is hosted at: https://simplegames-46v2swaudmtbld5233dwbp.streamlit.app/
Prerequisites
Before deploying to Streamlit Cloud, you’ll need:GitHub Account
Create a free account at github.com if you don’t have one.
Streamlit Cloud Account
Sign up for free at share.streamlit.io using your GitHub account.
Repository Access
Either fork the Python Arcade repository or push your own version to GitHub.
Deployment Process
Prepare Your Repository
Ensure your GitHub repository has the required files:
streamlit_app.py(main application file)requirements.txt(Python dependencies)- All game modules (
blackjack/,Hangman/,Rock_paper_or_scissors/)
The entry point must be named
streamlit_app.py or you’ll need to specify a different filename during deployment.Sign In to Streamlit Cloud
- Navigate to share.streamlit.io
- Click “Sign in with GitHub”
- Authorize Streamlit to access your GitHub repositories
Streamlit Cloud needs repository access to pull your code and set up automatic deployments.
Create a New App
- Click “New app” from your Streamlit Cloud dashboard
- Select your deployment method:
- From existing repo: Use code already on GitHub
- Start from template: Begin with a sample app
Configure Deployment Settings
Fill in the deployment configuration:
- Repository: Select your Python Arcade repository
- Branch: Choose
mainor your preferred branch - Main file path: Enter
streamlit_app.py
You can optionally set a custom subdomain under Advanced settings.
Advanced Configuration (Optional)
Click “Advanced settings” to configure:
- Python version: Specify version (default is 3.9)
- Environment variables: Add secrets or config values
- Custom domain: Use your own domain name (Teams plan)
Deploy the App
- Click “Deploy!”
- Streamlit Cloud will:
- Clone your repository
- Install dependencies from
requirements.txt - Launch your application
You can watch the build logs in real-time during deployment.
Configuration Requirements
requirements.txt
Yourrequirements.txt must list all Python dependencies:
Repository Structure
Ensure your repository maintains this structure:Optional: Streamlit Configuration
Create.streamlit/config.toml for custom settings:
Continuous Deployment (CI/CD)
Streamlit Cloud automatically redeploys your app when you push changes to GitHub:Automatic Deployment
Streamlit Cloud detects the push and automatically:
- Pulls the latest code
- Reinstalls dependencies if
requirements.txtchanged - Restarts the application
Deployments typically complete within 2-3 minutes.
Active users will see a brief “Reconnecting” message during redeployment.
Monitoring and Logs
Accessing Logs
- Go to your Streamlit Cloud dashboard
- Click on your app
- Select the “Logs” tab
- Application startup messages
- Print statements and errors
- Streamlit system messages
- Deployment events
Logs are retained for the current session only. For persistent logging, consider external services.
App Analytics
Streamlit Cloud provides basic analytics:- Viewer count: Number of active viewers
- Resource usage: CPU and memory consumption
- Uptime: App availability status
Health Checks
Streamlit Cloud automatically monitors:- App responsiveness
- Error rates
- Resource limits
Updating Your Deployment
Manual Reboot
If your app isn’t responding:- Go to your app’s dashboard
- Click the ”⋮” menu (three dots)
- Select “Reboot app”
Changing Settings
To modify deployment settings:- Click “Settings” from your app dashboard
- Update configuration (branch, Python version, etc.)
- Click “Save” - the app will redeploy automatically
Rolling Back Changes
To revert to a previous version:Custom Domains (Teams Plan)
While the free tier provides a*.streamlit.app subdomain, Teams plan users can configure custom domains:
- Navigate to Settings → Domain
- Enter your custom domain (e.g.,
arcade.yourdomain.com) - Add the provided CNAME record to your DNS settings
- Wait for DNS propagation (up to 48 hours)
Custom domains require a Streamlit Cloud Teams subscription.
Resource Limits
Streamlit Cloud free tier has the following limits:| Resource | Limit |
|---|---|
| CPU | 1 core (shared) |
| Memory | 1 GB RAM |
| Storage | Limited to app size |
| Apps | Unlimited public apps |
Best Practices
Optimize Performance
Use
@st.cache_data and @st.cache_resource to reduce computationHandle Secrets Securely
Store API keys in Streamlit Cloud secrets, not in code
Test Before Pushing
Always test changes locally before deploying
Monitor Logs
Regularly check logs for errors and warnings
Troubleshooting
Deployment Failed
Problem: App fails to deploy with errors Solutions:- Check build logs for specific error messages
- Verify
requirements.txthas all dependencies - Ensure Python version compatibility
- Check for syntax errors in code
App Running Slowly
Problem: App is slow or unresponsive Solutions:- Implement caching with
@st.cache_data - Reduce computational complexity
- Optimize session state usage
- Consider upgrading to a Teams plan for more resources
Module Import Errors
Problem:ModuleNotFoundError in production
Solutions:
App Goes to Sleep
Problem: App becomes inactive after no usage Solutions:- Free tier apps sleep after inactivity (expected behavior)
- App wakes automatically when accessed
- Upgrade to Teams plan for always-on apps
Security Considerations
Using Secrets
For sensitive configuration:- Go to app Settings → Secrets
- Add secrets in TOML format:
- Access in code:
Next Steps
Local Development
Set up local development environment
Streamlit Docs
Explore Streamlit’s documentation
Streamlit Cloud
Learn more about Streamlit Cloud features
Community Forum
Get help from the Streamlit community