Error is join streamlit-auth-login-ui and st-pages

Summary

i use the streamlit-auth-login-ui or streamlit-authercation.i cannot jump into my main form pages

Steps

i created a mutipages app with st-pages.the default page is main_app.py


if LOGGED_IN == True:
    st.markdown("Your Streamlit Application Begins here!")
    main_app.main()

i create a login app whitch name is login.py, with the streamlit-authercation or streamlit-auth-login -ui .
when i click login button.it go to main_app.py
and show my mutipages.
but 1. it is error:

The page that you have requested does not seem to exist. Running the app's main page

2.and my question is :how add the logout button on my mutipages` main form .
3. how streamlit-auth-login-ui jump into st-pages

can you help me,thanks

Hi @hillstone,

Thank you for sharing your question with the community!

Please edit your post to include a more complete code snippet and a link to your app’s GitHub repo so we can help you find a solution.

  1. the code of the login.py is as follow:
import streamlit as st
from streamlit_login_auth_ui.widgets import __login__
import main_app1
__login__obj = __login__(auth_token = "courier_auth_token", 
                    company_name = "Shims",
                    width = 200, height = 250, 
                    logout_button_name = 'Logout', hide_menu_bool = False, 
                    hide_footer_bool = False, 
                    lottie_url = 'https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json')

LOGGED_IN = __login__obj.build_login_ui()
st.markdown(""" <style>
    .css-1oe5cao {display: none;}
    </style> """, unsafe_allow_html=True
)

if LOGGED_IN == True:

    st.markdown("Your Streamlit Application Begins here!")
    st.markdown(st.session_state)

    main_app1.main()

  1. the code of main_app1.py is as follow:
from st_pages import Page, Section,show_pages, add_page_title
def main(name:str='hello world!'):

    show_pages(
        [
            Page("main_app.py",name="主页",icon="🏠"),
            Section(name="表格相关处理技术",icon="🏠"),
            Page("menuPages/table_linked.py", "主从表格",icon="💪",in_section=True),
            Page("menuPages/second.py", "样例2",icon="💪",in_section=True),
            Section(name="项目相关",icon="🏠"),
            Page("menuPages/xm.py", "项目",icon="💪",in_section=True),
            Page("menuPages/tax.py", "税率",icon="💪",in_section=True),
            # in_section=False用明确申明,该页不属于上面的菜单section子项目
            Page("menuPages/test.py",name="最后页面",icon="🏠",in_section=False),
        ]
    )
    st.write("## this is a main page ")
    st.write(name)

I condensed these two pages into a single page called app306.py, and it seems to work fine. Can you try this approach?

import streamlit as st
from st_pages import Page, Section, show_pages
from streamlit_login_auth_ui.widgets import __login__


def main(name: str = "hello world!"):
    show_pages(
        [
            Page("app306.py", name="主页", icon="🏠"),
            Section(name="表格相关处理技术", icon="🏠"),
            Page("menuPages/table_linked.py", "主从表格", icon="💪", in_section=True),
            Page("menuPages/second.py", "样例2", icon="💪", in_section=True),
            Section(name="项目相关", icon="🏠"),
            Page("menuPages/xm.py", "项目", icon="💪", in_section=True),
            Page("menuPages/tax.py", "税率", icon="💪", in_section=True),
            # in_section=False用明确申明,该页不属于上面的菜单section子项目
            Page("menuPages/test.py", name="最后页面", icon="🏠", in_section=False),
        ]
    )
    st.write("## this is a main page ")
    st.write(name)


__login__obj = __login__(
    auth_token="courier_auth_token",
    company_name="Shims",
    width=200,
    height=250,
    logout_button_name="Logout",
    hide_menu_bool=False,
    hide_footer_bool=False,
    lottie_url="https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json",
)

LOGGED_IN = __login__obj.build_login_ui()
st.markdown(
    """ <style>
    .css-1oe5cao {display: none;}
    </style> """,
    unsafe_allow_html=True,
)

if LOGGED_IN is True:
    st.markdown("Your Streamlit Application Begins here!")
    st.markdown(st.session_state)

    main()

1 Like

thanks ,i will try it again later.