Is it possible to add more than one views/url with streamlit?

Hello I am very new to streamlit.
I am very eager to make an web-application for my unsupervised learning model.
It is an awsome module.
In django words, is it possible to create more than one views/urls with streamlit?
And if it is yes. How is it possible?
Should I type streamlit codes in django views?

Hello @ozgurdugmeci, welcome to the forum!

Streamlit runs its own server. It’s not intended to be used within Django. However you can still use Django’s ORM to manage your database/access your models, and rely on Streamlit to create the views.

About that multi views/urls you’re requesting, you won’t be able to create new URLs, but you can still create a multi-paged app. A great example showcasing how it’d render is the awesome streamlit app made by @Marc.

Here’s a simple boilerplate code implementing that multi-page feature.

import streamlit as st

def main():
    # Register your pages
    pages = {
        "First page": page_first,
        "Second page": page_second,
    }

    st.sidebar.title("App with pages")

    # Widget to select your page, you can choose between radio buttons or a selectbox
    page = st.sidebar.radio("Select your page", tuple(pages.keys()))
    #page = st.sidebar.selectbox("Select your page", tuple(pages.keys()))

    # Display the selected page
    pages[page]()

def page_first():
    st.title("This is my first page")
    # ...

def page_second():
    st.title("This is my second page")
    # ...

if __name__ == "__main__":
    main()

And as you’re new to Streamlit, I suggest you look at some streamlit application showcases to see what you can do and how to do it, and check the documentation as well.

4 Likes

thanks @Synode that was what i was looking for!!!

1 Like

this is fck*ing #awesome and what i was looking for.
Is is mentioned somehwere in the docs?