chapter five

5 Sharing your apps with the world

 

This chapter covers

  • Options to share your app with users
  • Deploying an app to Streamlit Community Cloud for free
  • Connecting an app to an external service like an API
  • Safeguarding your API keys and other secrets in production
  • Managing your app’s dependencies

The moment you first successfully run an app built from scratch is magical—it’s when all the hours spent designing, developing, and refining finally pay off. After multiple iterations, bug fixes, and feature tweaks, the work comes together.

But what’s next? Do you keep it hidden away on a local machine? Unless you’ve built something solely for personal use, the answer is probably no. To make the app truly useful, you need to get it into the hands of its intended audience.

This chapter is about making the leap from local development to global deployment. We’ll briefly discuss the various paths available for sharing apps. We’ll then settle on one of them and walk through putting an app into production for the world to experience. Along the way, we’ll cover key considerations in making an app public, such as safeguarding confidential information like API keys and managing code dependencies. As always, we’ll take a practical approach, with direct, hands-on experience for everything we discuss.

5.1 Deploying apps

5.1.1 What is deployment?

5.1.2 Options for deployment

5.2 Deploying the to-do list app to Streamlit Community Cloud

5.2.1 Prerequisites

5.2.2 Deployment steps

5.3 Deploying an app that uses an external service

5.3.1 A joke of the day to entertain users

5.3.2 Using the requests library to connect to an API

5.3.3 Incorporating jokes in the app

5.3.4 Accessing an API key safely with st.secrets

5.4 Deploying changes to Streamlit Community Cloud

5.4.1 Using a requirements.txt file to manage Python dependencies

5.4.2 Using .gitignore to protect secrets.toml

5.4.3 Configuring secrets in Community Cloud

Summary