Bachir
Bachir

Reputation: 13

Hosting React frontend and flask backend website

So i made a react website that fetches data from my flask app, it works on my localhost without any problem,i know that to host the react app on ovh i just need to copy the build folder but i don't know how to host the flask app.

I tried hosting the flask app on pythonanywhere but since the flask app uses os.listdir() to scan some assets i can't host it.

I also tried to host it on ovh but apparently i can't do that with a normal hosting plan.

How can i host this flask app ?

Upvotes: 0

Views: 473

Answers (2)

Bachir
Bachir

Reputation: 13

Ahmad Alfan's answer works well, but the problem is that a normal ovh subscription only supports php and not python, so i converted my code to php. You can check at the bottom of the image that an individual ovh subscription doesn't support python. https://i.sstatic.net/Z45xB1Xm.png

Upvotes: 0

Ahmad Alfan
Ahmad Alfan

Reputation: 331

I have some experience working with file assets in the Flask app. Heroku worked for me.

But if you want to have an advanced setup, you can use Docker and deploy it to any cloud service.

Deploy Flask App on Heroku https://www.jcchouinard.com/deploy-a-flask-app-on-heroku/

My project with Flask + Heroku https://github.com/alfanme/dts-deployment-ann

Hope it helps!

Upvotes: 0

Related Questions