#Run Django and streamlit.

11 messages · Page 1 of 1 (latest)

simple oasis
#

Project ID: 133883fe-afe4-41d9-93d5-962a71344d56
I'm running a django server on railway.app and in my startup I also run a streamlit server on a local host. I then connect to the streamlit window using an iframe. however when I run this all, the iframe gets back: "localhost refused to connect."
To be honest, I'm not entirely sure what I am doing, but I figured this was a reasonable solution to include streamlit functionality into a django site.
In my railway.json
"startCommand": "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn mysite.wsgi & streamlit run app.py --server.port 8080",

elfin carbonBOT
#

Project ID: 133883fe-afe4-41d9-93d5-962a71344d56

simple oasis
#

This didn't help. I am going to try changing the port to 8000 to see if that is accessible.

polar raven
#

because once that web page makes it to the clients browser, it's now the clients localhost and not the internal localhost of the service. run Django and streamlit in separate services and use the domain for the streamlit service in the iframe element

simple oasis
#

Thanks Brody. I think you have it spot on there.
If I can bother you for one more thing: How do I restrict the access to the streamlit service so that only the django call can access it. One of the reasons I'm running this all through django is to restrict access.

polar raven
#

that I do not know as I have very little experience with Django and zero with streamli, sorry

simple oasis
#

Thanks. I was hoping there was a setting on the railway side that resticted connection to only be from certain urls

polar raven
#

I know there isn't, that's something your app would have to do

#

sounds like a cors thingy though, look into cors with streamlit

simple oasis
#

Thanks