Run Streamlit from python script

  • create run_main.py like this
import streamlit
import streamlit.bootstrap as bootstrap


def st_main_run(file, command_line, args=None):
    if args is None:
        args = []
    streamlit._is_running_with_streamlit = True
    bootstrap.run(file, command_line, args, {})
  • Compile the app

    1. create “.streamlit” folder, inside folder create “config.toml”, copy following into toml file

[global]

  developmentMode = false

[server]
port = 8501
[browser]
gatherUsageStats = false

  1. make a copy of ..\streamlit\static to build folder
  2. copy js file for used plot libs