On logout switch page to file in parent directory

Hi All,

I have created a multi page application with authentication taking help from below post.

https://discuss.streamlit.io/t/how-to-hide-all-pages-before-login/32508

Below is my folder structure:
Project

  • Login.py
  • Pages
    ** Create. py
    ** Edit.py
    ** Delete.py
    ** View.py

I am displaying only Login page 1st up and after successfull authentication I swtich page to “Create.py”. Till here everything works fine.

I want to have a logout button on “Create.py” which would in turn switch the control back to Login page(which is one directory up). Is there a hack to do this?

Streamlit version: v1.33.0
Python version: 3.10.7

Hi, any help here?

Hi @Lacasa,

I would recommend this new approach using the new st.page_link feature: New login page navigation example with streamlit 1.31

In particular, you can see how I created a logout button here streamlit-login/navigation.py at main · blackary/streamlit-login · GitHub

Thank you!
The solution looks perfect.

1 small thing, when ever I try to add a logo on sidebar using below line of code it somehow does not seem to work the sidebar remains blank. Should I use the CSS approach to have a logo(stored locally in my PC) on sidebar.

from streamlit_extras.app_logo import add_logo
add_logo(“C:/logo/logo.png”, height=90)

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

You can actually just do st.sidebar.image(<image location>) instead of using the streamlit extra. Either way, though, you will want to either use a logo file that is in the same folder as your app, or use a url.