Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

App.run() does not serve a mounted ASGI app (routes=[Mount(...)]) that works with uvicorn.run(app)

Abierto
#1,568 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
22/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

The App.run() docstring in lib/streamlit/web/server/starlette/starlette_app.py is the entry point, and it claims to reuse the same ASGI runner as streamlit run. Start by comparing how App.run() and uvicorn.run(app) build the Starlette routes from the routes=[Mount(...)] argument. Reproduce with the two-file example (page.py and app.py), where /bokeh/app should render "Hello from Bokeh" under app.run() as it does under uvicorn. Done means the mounted route and its websocket work under both app.run() and streamlit run.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug needs triage
Summary

Hi, I want to update my virtual observatory app (https://specsy.streamlit.app/) so that the user can download data selections from a Bokeh figure.

I have managed to get a working version by embedding a Bokeh server app (Bokeh 3.10 BokehASGI) in the Streamlit app via st.App(..., routes=[Mount("/bokeh", app=bokeh_app)]). When I serve the st.App with uvicorn.run(app), the mounted app works: the Bokeh page renders and its websocket callbacks run. When I start the same object with app.run(), the mounted route returns a blank white page.

Is mounting ASGI sub-applications via routes meant to be supported by App.run() and by streamlit run for st.App scripts? The App.run() docstring says it "reuses the same embedded ASGI server runner that streamlit run uses for st.App scripts".

The reason I am asking is that Streamlit Community Cloud launches apps with streamlit run, so I cannot use uvicorn.run(app) there. I would like a uniform Streamlit app for both the online and the offline installation.

Minimal reproducible example

page.py

import streamlit as st

st.write("Embedded Bokeh app below:")
st.iframe("/bokeh/app", height=300)

app.py

import sys

import streamlit as st
from starlette.routing import Mount
from bokeh.models import Div
from bokeh.server.asgi import BokehASGI


def bkapp(doc):
    doc.add_root(Div(text="Hello from Bokeh"))


bokeh_app = BokehASGI({"/app": bkapp})
app = st.App("page.py", routes=[Mount("/bokeh", app=bokeh_app)])

if __name__ == "__main__":
    if "--uvicorn" in sys.argv:
        import uvicorn
        uvicorn.run(app, host="localhost", port=8501)   # works
    else:
        app.run()                                       # mounted route is blank

Steps to reproduce

  1. python app.py --uvicorn and open http://localhost:8501/bokeh/app: "Hello from Bokeh" is shown, and the iframe in the Streamlit page also shows it.
  2. python app.py and open the same URL: blank white page, and the iframe in the Streamlit page is empty.

Expected behaviour

app.run() serves the routes passed to st.App(routes=...), including mounted ASGI apps with websockets, the same way uvicorn.run(app) does. I'd expect the same behaviour with streamlit run app.py.

Additional information

  • No errors in the terminal.

Environment

  • Streamlit: 1.65.0
  • Bokeh: 3.10.0
  • Python: 3.13
  • OS: Linux
  • Browser: Firefox

Thanks a lot for any advice.

Lenguaje dominante
JavaScript
Estrellas
178
Forks
711
Merge medio
2 d 41 min
PR fusionados (30 d)
29

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de streamlit/docs

Todos los issues de streamlit/docs

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.