I have deployed an app using Streamlit Community Cloud. The app loads predefined workouts and allows users to change the workout using sliders for week and day. There are also widgets that support recording the user’s workout into a database. Right now the database setup is very simple. I have a data directory with a workout database csv. All the lifts, weights, set numbers, reps are written into that csv when the button is clicked. My goal with the app was to make it easier to record my own lifts, but I am wondering how this would work for other users.
For example, my git repo has my personal data in the workout database csv. I noticed that when I enter a workout into the database using the deployed app, the app doesn’t push the change to the database in my git repo. This is fine because when I want to update the database, I run a docker container locally and it updates my data locally just fine. My question is, what happens when I write to the database csv using the streamlit community cloud deployed app - does Streamlit create a unique instance of the app and unique instance of the database for each user? It seems to be writing and storing the data somewhere. A follow on question - I haven’t set up user authentication, so if the answer to the last question is “yes,” how does that work - does Streamlit create unique instances of the app and database by ip address or something?
Additional Questions
(a) My app can be run as a docker container (e.g., using docker-compose up) or using streamlit run Home.py. I am curious, does streamlit community cloud automatically run it as a container since my git repo is configured to run the app using Docker? Or do I need to manually do something to get it to run as a container.
(b) Is there a way for users to create their own name and password? I’ve done some digging and it seems like the tutorials suggest that the app creator make accounts and passwords for users (e.g., How to save user specific data?). I thought I read this was streamlit premium feature, but the streamlit plans do not appear to exist at this time.
If you are reading and writing to a csv file sitting alongside your Python code, then:
Everyone is reading and writing to the same csv unless you are dynamically changing the name of the csv file per user.
The csv will get overwritten with what is in the original from your git if your app reboots.
If you are looking to dynamically generate data that persists in some form, you should use external data storage outside of Streamlit Cloud to read and write to.
Whatever file you point Streamlit Cloud to as your main app, will get streamlit run your_file.py. Streamlit Cloud is run on debian containers and you can’t alter that part.
You can use a component to add authentication and you’d have to handle storing and retrieving user information from your external data source.
Thank you. I was refreshing my app in the browser and didn’t think to reboot from the streamlit community cloud page where you can manage the app. The outcome seems interesting. When I write the workout data on the deployed app all of the data on the deployed app updates. Since the app reads the csv to display dataframes on the app, the csv must have been updated as well. However, when I looked at Github there was no change to the csv file. I then rebooted the app and the recent additions to the workout database on the app disappeared.
I’m not sure why that happened, but in any event, if I start adding users I will pay closer attention to the database articles here.
Thanks for clarifying that my docker container is not used in streamlit community cloud.
I just scanned the article you shared and it seems to mirror other content I read where you manually enter usernames and passwords for users. It sounded like a future post might get into allowing users to register themselves.
Right. The deployment process copies files from Github to Streamlit Cloud. There is no built-in process to write files back to Github. When the app reboots, you are starting over from scratch, copying file from Github. You can read and write within Streamlit Cloud, but you can’t rely on those files to persist. That’s why you need some other, external source to read and write to. Even if you don’t manually reboot your app, you may fond one day that all your data is gone just because some system update or oopsie rebooted things.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.