How to set a different port number for different streamlit program in a same machine?

example:
I build 1.py and 2.py in a same desktop.
If I want to run 1.py and 2.py together, how can I use different port to run 1.py and 2.py in a same explorer at the same time?
Thank you.

5 Likes

There is a param called server.port. So you can do something like:

streamlit run streamlit_app.py --server.port 8080
11 Likes

This is correct if you want to specify the exact port, or Streamlit will just increment the port number to 8502, 8503, etc. if 8501 is in-use.

1 Like

Hi, when I use --server.port 8080 to run second .py program, cmd window told me the former port 8051 is already in use, then the cmd window closed automatically, I did not see the setting was working.
How will it happen? And the file under root: C:\Users\Username.streamlit have to build config.toml file, if we need to build it, the content should be someting like what?

1 Like