Streamlit Frequently Asked Questions¶
Here are some frequently asked questions about Streamlit and Streamlit Components. If you feel something important is missing that everyone needs to know, please open an issue or submit a pull request and we’ll be happy to review it!
How can I make
st.pydeck_chartuse custom Mapbox styles?
If you are supplying a Mapbox token, but the resulting
pydeck_chartdoesn’t show your custom Mapbox styles, please check that you are adding the Mapbox token to the Streamlit
config.tomlconfiguration file. Streamlit DOES NOT read Mapbox tokens from inside of a PyDeck specification (i.e. from inside of the Streamlit app). Please see this forum thread for more information.
How can I make Streamlit watch for changes in other modules I’m importing in my app?
By default, Streamlit only watches modules contained in the current directory of the main app module. You can track other modules by adding the parent directory of each module to the
export PYTHONPATH=$PYTHONPATH:/path/to/module streamlit run your_script.py
Manually deploying Streamlit¶
How do I deploy Streamlit on a domain so it appears to run on a regular port (i.e. port 80)?
You should use a reverse proxy to forward requests from a webserver like Apache or Nginx to the port where your Streamlit app is running. You can accomplish this in several different ways. The simplest way is to forward all requests sent to your domain so that your Streamlit app appears as the content of your website.
Another approach is to configure your webserver to forward requests to designated subfolders (e.g. http://awesomestuff.net/streamlitapp) to different Streamlit apps on the same domain, as in this example config for Nginx submitted by a Streamlit community member.
How can I deploy multiple Streamlit apps on different subdomains?
Like running your Streamlit app on more common ports such as 80, subdomains are handled by a web server like Apache or Nginx:
Set up a web server on a machine with a public IP address, then use a DNS server to point all desired subdomains to your webserver’s IP address
Configure your web server to route requests for each subdomain to the different ports that your Streamlit apps are running on
For example, let’s say you had two Streamlit apps called
Calvinis running on port 8501. You set up app
Hobbesto run on port 8502. Your webserver would then be set up to “listen” for requests on subdomains
hobbes.subdomain.com, and route requests to port 8501 and 8502, respectively.
Check out these two tutorials for Apache2 and Nginx that deal with setting up a webserver to redirect subdomains to different ports:
How do I deploy Streamlit on Heroku, AWS, Google Cloud, etc…?
Here are some user-submitted tutorials for different cloud services:
How to Deploy Streamlit to a Free Amazon EC2 instance, by Rahul Agarwal
Host Streamlit on Heroku, by Maarten Grootendorst
Host Streamlit on Azure, by Richard Peterson
Host Streamlit on 21YunBox, by Toby Lei
Does Streamlit support the WSGI Protocol? (aka Can I deploy Streamlit with gunicorn?)
Streamlit does not support the WSGI protocol at this time, so deploying Streamlit with (for example) gunicorn is not currently possible. Check out this thread regarding deploying Streamlit in a gunicorn-like manner to see how other users have accomplished this.
What browsers does Streamlit support?
The latest version of Streamlit is compatible with the two most recent versions of the following browsers:
You may not be able to use all the latest features of Streamlit with unsupported browsers or older versions of the above browsers. Streamlit will not provide bug fixes for unsupported browsers.
Below are some selected questions we’ve received about Streamlit Components. If you don’t find your question here, take a look on the Streamlit community forum via the Components tag.
How do Streamlit Components differ from functionality provided in the base Streamlit package?
Streamlit Components are wrapped up in an iframe, which gives you the ability to do whatever you want (within the iframe) using any web technology you like.
There is a strict message protocol between Components and Streamlit, which makes possible for Components to act as widgets. As Streamlit Components are wrapped in iframe, they cannot modify their parent’s DOM (a.k.a the Streamlit report), which ensures that Streamlit is always secure even with user-written components.
What types of things aren’t possible with Streamlit Components?
Because each Streamlit Component gets mounted into its own sandboxed iframe, this implies a few limitations on what is possible with Components:
Can’t communicate with other Components: Components can’t contain (or otherwise communicate with) other components, so Components cannot be used to build something like
Can’t modify CSS: A Component can’t modify the CSS that the rest of the Streamlit app uses, so you can’t create something like
Can’t add/remove elements: A Component can’t add or remove other elements of a Streamlit app, so you couldn’t make something like
How do I add a Component to the sidebar?
You can add a component to st.sidebar using the
withsyntax. For example:
with st.sidebar: my_component(greeting="hello")
In fact, you can add your component to any layout container (eg st.columns, st.expander), using the
col1, col2 = st.columns(2) with col2: my_component(greeting="hello")
My Component seems to be blinking/stuttering…how do I fix that?
Currently, no automatic debouncing of Component updates is performed within Streamlit. The Component creator themselves can decide to rate-limit the updates they send back to Streamlit.