I want to create a publically available website which shows data I stored in a database which is updated every day

Hi all,
I am new to Streamlit. I am a data analyst and use Python frequently I have an idea to aggregate agricultural data from various public resources and show it in graphs etc with a small description on a public website. I already have a sponsor who will pay for their logo on the public website. I looked into Django but I do not have experience with html/CSS/JS. I saw that Streamlit would be perfect for this but I do not know if Streamlit works as a public website with for example 500 visitors per week. I do not need login authentication or anything, I just want to show interactive data visualisations which are based on my database which is updated every day (I already have a python script which fetches data and puts it in a database).

Is Streamlit a good idea for the idea above? And if so; what do I have to keep in mind? / how te get started?

1 Like

Hi @bas1,

Thanks for sharing this question!

Streamlit would work great for your project. You can build your app and deploy it to Streamlit Community Cloud. As for refreshing your app everyday to match the data in your DB, you can use the recently released st.fragment to set the interval to auto-rerun your app.

Here’s a rough example to get you started:

import streamlit as st
from datetime import datetime, timedelta

def fetch_data():
    # fetch data from your db

# Define a fragment that fetches and displays data
@st.experimental_fragment(run_every=timedelta(days=1))  # Run the fragment daily
def update_data_fragment():
    # Fetch data from the database
    data = fetch_data()
    # Visualize the data 
    st.dataframe(data)

# Call the fragment function to display the data
update_data_fragment()
2 Likes

Hi @tonykip,
Thanks a lot for your answer. Is it possible as well to deploy it using an available domain of my choosing? For example: myagriculturaldataagrigator.com? Or isn’t this possible with Streamlit.
Also: how do I make sure that my update_data_frament() function can run without my machine being on?

1 Like

Streamlit offers custom domains that end with .streamlit.app. For other domain endings, you would need to get those separately through a domain service.
To rerun your st.experimental_fragment you can use the rerun_every parameter to set the time to rerun like in the image below.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.