Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How and where do I deploy a Flask + React web app?

I am building a web app with a Flask backend and a React front end, and I would now like to deploy it, buy a domain, and set it up. What is the easiest way to do this?

Here's my research:

  • This website shows how to deploy an app on Heroku. I did this, but Heroku seems to be unavailable a lot, at least today.
  • This blog post seems to suggest I could create a GCE instance and run things there, though (i) it seems like a little more configuration that I'd like (ii) I would need a way to link the nginx server to my domain. I suppose the benefit is that the two apps run on the same machine?
  • This SO post had OP redo his work and it somehow worked. I'm not sure how to deploy Docker apps online, though.

Is there an easy way to deploy to a reliable service (Google Cloud/AWS/Azure)? My code has the following structure:

build/                 # Result of `yarn build`
server/
    server.py          # Flask server
src/                   # React code
    Component/
        Component.js
        Component.sass
    index.css
    index.js
    ...
public/
    index.html
    # Images and other stuff.
like image 529
Rahul Avatar asked Nov 28 '25 02:11

Rahul


1 Answers

I figured out how to do this using Azure. I created an App Service, then installed the Azure Tools VS Code extension. You need to move the Python server to the root directory and rename it to app.py (so the .env is also in the root folder), and then you can right-click your App Service in VS Code (in the Azure Tools tab) and then click Deploy to Web App. Easy!

like image 183
Rahul Avatar answered Nov 29 '25 18:11

Rahul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!