$ streamlit run
This command starts your Streamlit app.
Syntax
Arguments
<entrypoint file or directory> (optional): The path to your entrypoint file or directory for your Streamlit app.
- If not provided: Streamlit will try to run
streamlit_app.pyfrom the current working directory. - If a directory path is provided: Streamlit will try to run
streamlit_app.pyin the specified directory. - If a file path is provided: Streamlit will run the specified file.
In a multipage app with st.navigation, your entrypoint file acts as a router between your pages. Otherwise, your entrypoint file is your app's homepage.
Options
Configuration options are passed in the form of --<section>.<option>=<value>. For example, if you want to set the primary color of your app to blue, you could use one of the three equivalent options:
--theme.primaryColor=blue--theme.primaryColor="blue"--theme.primaryColor=#0000FF
For a complete list of configuration options, see config.toml in the API reference. For examples, see below.
Script arguments
If you need to pass arguments directly to your script, you can pass them as positional arguments. If you use sys.argv to read your arguments, sys.argv returns a list of all arguments and does not include any configuration options. Python interprets all arguments as strings.
sys.argv[0]returns the the path to your entrypoint file, even if you did not explicitly provide it.sys.argv[1:]returns a list of arguments in order and does not include any configuration options.
Examples
-
If your app is named
streamlit_app.pyin your working directory, you can run it with the following command:Python -
If your app has a different name and is in your working directory, run it like the following command:
Python -
If your app is named
streamlit_app.pyin a subdirectory, you can run it like the following command:Python -
If your app has a different name and is in a subdirectory, run it like the following command:
Python -
If your app is saved in a public GitHub repo or gist, run it like the following command:
Python -
If you need to set one or more configuration options, run it like the following command:
PythonOr if using the default
streamlit_app.py:Python -
If you need to pass an argument to your script, run it like the following command:
PythonWithin your script, the following statements will be true:
Python
Still have questions?
Our forums are full of helpful information and Streamlit experts.
