This is super cool! It’s not even particularly hacky.
Can you provide a little more info on why you want to embed Flask into Streamlit, though? If your usecase is common enough, I’d love to understand how we can address it with a more official solution .
@thiago thanks for the kind words! So if you couldn’t tell I’m the main developer on D-Tale. Over the last year plus that I’ve been working on it people have been continually asking me if it can be integrated with Streamlit. I finally got around to try to do that and this was the best solution I could come up with.
D-Tale essentially spins up an on-demand Flask process for viewing pandas dataframes (and other similar data structures), but it also allows itself to be integrated into other Flask applications. And now after digging into how Tornado works it be can integrated with that too (I also had to figure out how to integrate it with Django as well so this is the first thing I’ve had to hack to get it integrated )
Anyways, if I’m looking at what I’ve done and how you could make it a little easier to do without having to override the streamlit.server.server. start_listening
would be if you added a function that people could use to add additional routes to the tornado server. That’s essentially all I’m trying to do.
Really appreciate your response because Streamlit is really cool and if I can make it easier for users of my tool by integrating it with yours it’s a win-win! Let me know if there’s anything else I can do to help.