HelioHost Posted November 25, 2024 Posted November 25, 2024 Username: johne, Server: Tommy, Main domain: jdproject.heliohost.usHi, I'm a college student doing a programming assignment, and my assignment is to create a simple web socket server using pure Python (no frameworks). So my web socket server returns a web HTML file, and saves user submitted form data to a csv file. It works in my localhost, but I'm confused though on how to get the web server running on a live website. ??????I'm 100% new to web hosting, and like there's like no other web host that allows for running a made-from-scratch socket web server. Online, I saw about HelioHost allowing for socket programming (as long as it uses reverse proxies), so I paid the $1 to get my project working, since no other web hosts allows for that. But I'm confused on how to make my website run the Python web server script so it can handle the user requests. I also have to present on this project on well, so I want to make sure the website, if it crashes or whatever, automatically runs the Python web server script again. But I don't know how to do any of this ? I see this Plesk interface but there's no command line or SSH or anything to really tell the website to run the Python script automatically. The best I can do is the Scheduled Tasks, but I'm not sure if that would create multiple copies of the Python interpreter and then overload the website, and I'm not sure that will ensure that the Python script (I only need one instance of it) keeps running to keep the website up. ??????There's not much resources out there on the internet to help, so I just have to experiment I guess. If you guys have any suggestions, please let me know. I don't want to mess up this website. This project was certainly a nightmare for me and took a lot of time to do. Thanks for reading, and have a great Thanksgiving, John
Krydos Posted November 25, 2024 Posted November 25, 2024 You definitely won't be able to use scheduled tasks to start your Python websocket because scheduled tasks run in a jailshell where the Python binary doesn't even exist. I recommend you use this method for starting and stopping your Python script https://wiki.helionet.org/tutorials/discord-bot#starting-and-stopping-your-bot The rest of that guide is for a Discord bot, but the same bot_control section should work for your Python websocket. As far as proxying the websocket through you can either use Apache with .htaccess, which you can set up yourself. You can also proxy the websocket through Nginx, but an admin has to set that up for you.
Recommended Posts