I am pretty new to streamlit and coding in general so pls forgive me if this question is really basic but I can’t find an understandable tutorial that is not old and half of the links wont work or its for linux or smth and I dont understand how I use it on windows.
To my question: I want to deploy a little GUI for my Project that is accesible from different PCs, the problem is that I can’t use cloud services because I want the data to stay on my own PC and not upload it. What i found is Apache, I have my Streamlit App running localy and I can see the standart “It works” message from Apache, but I cant figure out how to deploy my app via apache. The guide for apache in this forum is very confusing so could someone maybe explain the basic steps to me?
Using Apache would still be a means of deploying your app on the internet. Are the PCs that you want your app to be accessible from using the same local network?
You can build simple docker containers and deploy them even on a windows machine. I found this article useful (check the last paragraph ‘dockerizing…’) With this the apps run perfectly in the background (no terminal).
Ok I really dont understand the tutorial you posted, he posts lines of code that i dont know where and when to write.
I tried to follow this streamlit tutorial but i got stuck at “Build a Docker image” when I use
docker build -t streamlit .
in cmd. It tells me:
C:\Users\PPreussler\PythonProjekte\app>docker build -t streamlit .
[+] Building 0.0s (1/2)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2B 0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount522145575/Dockerfile: no such file or directory
Sorry for the confusion. Looks like you don’t have the Dockerfile in the same folder as your python files for the app. You have to create the dockerfile and it should contain all the lines the article explains in section 2), of course adapted to your app. For example, if your streamlit file is ‘myapp.py’ and it imports another .py file ‘mymodule.py’ from the same folder , then the Dockerfile could look like this:
Another file you need is requirements.txt to import modules available via pip install into the container , in particular streamlit itself. For example if you need pandas and plotly, requirements.txt looks like this;
streamlit
pandas
plotly
The docker build etc commands are executed on a normal windows terminal/shell (dos box) . Check that you are in the right folder where your app files are located.
After you did run the the container once form the commandline you can start and stop it also from the Docker App GUI without the need for the terminal window!
Btw, with the docker run command you can also map your app to a different tcpip port, For example to map it to 8510 instead of the default 8501 execute (maypp1 is assumed to be the name of your container) :
docker run -p 8510:8501 myapp1:latest
If you want to run multiple streamlit containers choose a distinct port for each app (8510, 8511…)
So I just finished a tutorial about docker containers and how to build your own.
The problem was not that I didn’t name the container, the problem was that I created the dockerfile with windows rmt>new>.txt (sorry if thats not how you write it but i hope it’s understandable) and docker build didn’t recognise the dockerfile.
What solved it was to create the docker file in Visual Studio Code. now it isn’t a .txt file but just a “file” and now docker build works just fine. Just ran it the first time on my pc.
is it working now? i want to deploy my straemlit apps to, and confused how to do it.
if it’s already run, what ip address or domain name when you access it?
Hey there, it worked once last week but then I did something and it doesnt anymore, as soon as I got it figured out I wanted to write some sort of solution here anyways. ^^
as long as there is a docker container with 2.7 to download this should be easy (FROM python:2.7 in dockerfile) but I dont think streamlit supports versions 2x.