Dynamic apps and uwsgi

Hi. Love Streamlit’s concept, and am enjoying tinkering with it locally. We’ve used Plotly Dash and others in the past but Streamlit looks much more suitable - depending on deployment options.

Will it be possible to host Streamlit ourselves, using Uwsgi and Nginx, to have multiple apps? I.e. domain.com/streamlit/app1 and domain.com/streamlit/app2 both running off one uwsgi config? We don’t want to have multiple uwsgis so we can quickly create a new app and have it up and running in minutes, without endless configuration and nginx routing.

This was also quite hard in Dash, so we stopped using that, but I can’t believe we’d be the only ones to find this massively useful.

Grateful for thoughts.




HI @will, welcome to the forum! That is definitely possible. I am not an expert when it comes at Uwsgi, but I did a quick prototype with nginx in the past.
This gist has the nginx config that worked for me:

Note I had to support Websockets, so I added a couple of directives for that. Some context here.

Of course, this is a start that will work locally, but you can host it using the same strategy. Also, any proxy should let you do this kind of thing and I believe people have done several experiments with cloud setup and they documented it on the forum.

We are planning to release a StreamlitForTeams offering in the future that should make this much easier. You can sign up here: https://streamlit.io/forteams/


Hi @will, thanks for checking out Streamlit, and for the kind words!

A bit more context on the Streamlit web architecture:

Streamlit serves data over HTTP and WebSockets, using a single (configurable) port. If you have multiple Streamlit apps running on the same host, you could configure each one to use a different port, and then have your reverse proxy route HTTP/WebSocket data to the proper Streamlit app.

Streamlit uses the Tornado framework under the hood, which does not support being run in a WSGI container:

The reverse is not supported; the Tornado Application and RequestHandler classes are designed for use with the Tornado HTTPServer and cannot be used in a generic WSGI container.

But as @monchier notes, you can certainly configure Nginx as a reverse proxy for multiple Streamlits running on the same host. The Tornado docs have more details about running a Tornado app from behind nginx here: https://www.tornadoweb.org/en/stable/guide/running.html