Launching streamlit webapp from desktop shortcut

Hi everyone!

In the last few months I have worked on an internal Streamlit application that will be handed over to my colleagues that are not technical. This means that the Streamlit application will solely run local host because of data privacy and compliance. Internal cloud hosting is rather expensive and requires lots of maintenance.

A lot of material is out there using tools such as pyinstaller to make an executable on the desktop however I found it very time consuming. I found it much easier installing python via anaconda on their machines and creating a shortcut to run a command line. The code does not need to be updated so there is not much that I need to do after installing. I thought it would be nice to share a step-by-step guide to recreating this shortcut and I hope to be able to help those who are in a similar situation.

Step 1: Locating anaconda prompt
First you need to locate the path to your anaconda prompt. Simply go to Start and locate the Anaconda folder. Locate the Anaconda prompt and left click to see the folder location like this:

Step 2: Create the shortcut to the anaconda prompt
Now that you know the path to your anaconda prompt, go back to your desktop and right-click on an empty space and navigate New > Shortcut.
Windows will now ask you what the location is to your shortcut and click the browse button and navigate through the path you found in step 1. Once you find it, click Next and Windows will ask you to name your shortcut. You can give it any name you want for now.

Step 3: configure the shortcut to run a specific command
If you click on your shortcut you will see the command prompt open up empty. We now need to insert a command there to run automatically once you click. To do this, right-click on your shortcut and navigate to properties. Once there, you want to locate the Target field:

I suggest you empty the target field and fill in the following:

%windir%\System32\cmd.exe "/K"

Anything you write after “/K” will be executed in your Anaconda prompt. You can also combine different commands by the & symbol.
To navigate to your python file use the cd command and once you find it use the streamlit launch command to launch your webapp. It should look something like this in the end:

%windir%\System32\cmd.exe "/K"  cd Users\Desktop\Python projects & streamlit run myapp.py

You can even change the icon for your shortcut, the background of your prompt etc in the properties of your shortcut.

I hope this little guide is useful to what you intend to make. This might be a good solution for those that have created a web app that is hard to deploy internally because of security restrictions. If you have any questions feel free to ask!