Integration with flask app

I am trying to integrate streamlit app with flask app. what would be the recommendations.
I also want to save the rendered html file from streamlit so i can use flask.render_template to show the interative streamlit app inside flask.

is there an option to save it to html ?

1 Like

Hey @qxlsz, thanks for checking out Streamlit!

Streamlit runs its own web server via the Tornado framework, and there’s no good way to embed a Streamlit app inside a Flask server.

(Serving an interactive Streamlit app via flask.render_template isn’t feasible, because Streamlit apps are not static; when you interact with your Streamlit app, it is re-running your Python code to generate new results dynamically.)

You could, however, run Streamlit alongside a Flask app (or possibly embed your Streamlit app inside an <iframe> that’s served from your Flask app). But before I send you too far down a rabbithole, can you explain in more detail what you’re trying to achieve?

1 Like

Would there be a possibility in the future to have an ability to host endpoints via the same Streamlit app? This could help merge / migrate Flask or other types of app into streamlit - I hope I’m making sense. My question is similar but I want to also use the same server as an endpoint server/host.

Or do you recommend that we host a separate endpoint server and keep it separate from streamlit server?

I think my query got answered here Streamlit restful app