Deploying App with Executable

First time posting in the forum, sorry for any error.

I’m working at a small company and have to develop dashboards for different departments (Operations, HR, Finance). One issue I’m facing is that I can’t share the localhost application because the port (usually 8501) is blocked by the IT team.

I tried to work around this by compiling the dashboard into a .exe file and sharing it via the respective team folder. However, the problem is that all the packages used in the dashboard are being bundled into the .exe, which is making it noticeably slower to run.

Has anyone dealt with a similar issue and found a better solution?

Hi,

With Bat To Exe Converter, you can create a portable .exe that executes a .bat script like the following;

@ECHO OFF

set "root=C:\route folder app"

call "%root%\venv\Scripts\activate.bat"

streamlit run "%root%\app.py"

or

@ECHO OFF

set root=route folder

call streamlit run "route folder\app.py"

, which activates the virtual environment and launches Streamlit. By using a local virtual environment and enabling compression, you should reduce the size of the executable and improve performance compared to bundling all global dependencies. If performance remains an issue, I recommend exploring PyInstaller.

1 Like

You can change the port in two ways

  • Firstly, when the running the application via CLI by setting server.port=8000 or anything that you like
  • In streamlit’s config file there’s an option to define port.

Converting application into executable just for port blocked issue is an high overkill and comes with heavy overheads. Python really doesn’t like being an .exe, said generally.

That said I highly recommend that take this as an opportunity to explore proper deployment including production grade options like SSL encryption. For easier times, see deployment with GCP directly from GitHub repo using Dockers. It’s almost a plug and play ! Happy to share more details as needed.

1 Like

I tried changing the server port, but the Dash app gets stuck in an infinite loading state when others try to access it via the network URL. Maybe deploying it with Docker would be easier.
Is the tutorial provided by Streamlit for Docker deployment reliable?

but the Dash app gets stuck in an infinite loading state when others try to access it via the network UR

This seems to a bigger issue at hand - as the application should not be impacted by the change of port at all. My suggestion will be look application and why it’s getting stuck. This is the far easiest and simplest thing here to cross.

Feel free to share code snippet here as well.

And as for deployment - it’s not alone Docker, but instead docker + GCP. This will expose your application to internet. MAKE SURE TO SECURE IT before exposing it to internet. There are many official documentation from Streamlit to do this.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.