简体   繁体   English

如何以及在何处部署 Flask + React web 应用程序?

[英]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.我正在构建一个带有 Flask 后端和 React 前端的 web 应用程序,我现在想部署它,购买域并进行设置。 What is the easiest way to do this?最简单的方法是什么?

Here's my research:这是我的研究:

  • This website shows how to deploy an app on Heroku . 该网站展示了如何在 Heroku 上部署应用程序 I did this, but Heroku seems to be unavailable a lot, at least today.我这样做了,但是 Heroku 似乎经常不可用,至少今天是这样。
  • 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. 这篇博文似乎建议我可以创建一个 GCE 实例并在那里运行,尽管 (i) 它似乎是我想要的更多配置 (ii) 我需要一种方法将 nginx 服务器链接到我的域。 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. 这篇 SO 帖子让 OP 重做了他的工作,并且它以某种方式起作用了。 I'm not sure how to deploy Docker apps online, though.不过,我不确定如何在线部署 Docker 应用程序。

Is there an easy way to deploy to a reliable service (Google Cloud/AWS/Azure)?有没有一种简单的方法可以部署到可靠的服务(谷歌云/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.

I figured out how to do this using Azure. I created an App Service, then installed the Azure Tools VS Code extension.我想出了如何使用 Azure 来做到这一点。我创建了一个应用服务,然后安装了 Azure 工具 VS 代码扩展。 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.你需要将 Python 服务器移动到根目录并重命名为app.py (所以.env也在根文件夹中),然后你可以在 VS Code 中右键单击你的 App Service(在 Azure 工具选项卡中) 然后单击部署到 Web 应用程序。 Easy!简单的!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 IIS 中部署 Flask 应用程序? - How do I deploy a Flask application in IIS? 为什么我不能在 heroku 上部署反应 flask 应用程序? - why can't i deploy react flask app on heroku? 如何通过PyCharm在生产服务器中部署Flask Web应用 - How to deploy Flask Web app in Production server from PyCharm 如何在不使用SQLAlchemy的情况下将Flask应用程序部署到Heroku? - How do deploy a Flask app to Heroku without using SQLAlchemy? 如何在具有崩溃保护的 Lightsail 上部署 flask 应用程序? - How can I deploy a flask app on Lightsail with crash protection? 如何部署我的 Python Flask 开发应用程序,以便网络 (Wifi) 上的其他设备也可以访问它? - How do I deploy my Python Flask dev app so other devices across the network (Wifi) can also access it? 如何在 linux 服务器中更新我的 Web 应用程序功能? Web 应用程序是使用 Python、Flask、uwsgi 和服务器 nginx 构建的 - How do I update my web app features in the linux server? web app is build with Python, Flask, uwsgi and server nginx 如何在 Azure Web 应用程序上运行 apt-get 或在 azure 上的烧瓶中导入 cv2? - How do I run apt-get on an Azure web app or import cv2 in flask on azure? 单击传单Web应用程序后,如何将纬度和经度返回给flask服务器? - How do I return latitude and longitude to flask server after clicking on a leaflet web app? 如何将 Flask 应用程序作为包部署到 App Engine? - How to deploy Flask app as package to App Engine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM