Run streamlit app on virtual server

Hi guys!
Please let me know where to fix the problem if possible.
I want to host a personal application on a virtual server.
The server has a window for configuring the python application.
In this window, you need to select the python application launch file, and also specify the entry point to the application.
The test run file for has the following code:

import os
import sys

sys.path.insert(0, os.path.dirname(__file__))

def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    message = 'It works!\n'
    version = 'Python %s\n' % sys.version.split()[0]
    response = '\n'.join([message, version])
    return [response.encode()]

If I specify it as a launch file, and also indicate that the entry point is an application (function), then when I launch the application from the link, I get the message “It works, and the python version”

But, how can I start the streamlit application in this case?
The start page of my application streamlit to be in the module.
On my home computer, I would need to run the command:

streamlit run

But I don’t understand how to run this application on the server, because it starts there through the “Run application” button.
I have already used streamlit many times, but all this experience was on the local computer.
I will be glad for your tips.

Hi @promo2016mened

It seems that you’re trying to deploy to a virtual server, there’s actually a detailed step-by-step tutorial showing how to deploy to AWS that is available at How to Deploy a Streamlit App using an Amazon Free ec2 instance? | by Rahul Agarwal | Towards Data Science

This approach may be a bit on the advanced side, however, if you’re looking for an easier way to deploy (for free), then you might want to deploy to the Streamlit Community Cloud. For this, here are step-by-step tutorials:

Hope this helps!

Best regards,

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