Issue
To be more specific, I have some Flask code that reads from an Excel file in a directory, web scrapes another website every minute to get new data, and appends it to the same Excel file. That excel file will be available for download on my localhost. Everything works fine on my computer and localhost, but I’m confused how this works when it’s running on a web server and not on my computer.
I’ve been digging through Stackoverflow for an answer/clarification and have yet to come across an answer that can explain how this works or if it’s even possible.
Thank you for your time!
Solution
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.
Answered By – EugeneProut
Answer Checked By – David Marino (Easybugfix Volunteer)