More specifically, I have some Flask code that reads from an Excel file in my directory, then it web-scrapes another website every minute for new data, and appends it back into that same Excel file. That Excel file is then available for download on my localhost. Everything works fine on my computer and on localhost, but I am just confused how exactly this would work when it is running on a web-server and not on my computer.
I have been digging around Stackoverflow for answers/explanations, but I still have not stumbled upon an answer that could explain how this works or if it is even possible.
Thank you in advance for your time!
Yes, this is totally possible! You just need a few different applications instead of the Flask server.
Server & Proxy
The biggest difference between running Flask locally and running it on a server is that you don't want to use the default Flask server. You want to use a dedicated server to run the application and then something reverse proxy the app if you want to use a domain.
For the server: you can use gunicorn, this is a dedicated Python server. This is what will execute the app.
For the reverse proxy: you can use nginx. This will allow you to use a domain name, but this is optional.
This is a great resource for learning how to host apps with Flask on Ubuntu. Digital Ocean's guide to serving Flask Apps. This can be used on any provider, not just Digital Ocean.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With