[英]How to serve Flask and Apache on a single port on web server
Is it possible to set up Flask with Apache such that some URL paths link to a flask server and others link to an Apache server?是否可以使用 Apache 设置 Flask,以便某些 URL 路径链接到 Flask 服务器,而其他链接到 Apache 服务器?
Main page: https://blackfynnpythonlink.ml/simple_heart/ Apache server gets called and the built site gets sent to the user主页: https : //blackfynnpythonlink.ml/simple_heart/ Apache 服务器被调用并将构建的站点发送给用户
Python functions for javascript to call : https://blackfynnpythonlink.ml/api/ Flask server takes HTTPS requests and uses them to call a python API and return the results as HTTPS response用于 JavaScript 调用的 Python 函数: https: //blackfynnpythonlink.ml/api/ Flask 服务器接受 HTTPS 请求并使用它们来调用 Python API 并将结果作为 HTTPS 响应返回
In my specific case I have a javascript front end that needs to make calls to a python API.在我的特定情况下,我有一个需要调用 python API 的 javascript 前端。 I used to do this with a separate server running Flask but I have been told this is inefficient and not secure so I am trying to merge the two together.我曾经使用运行 Flask 的单独服务器执行此操作,但有人告诉我这是低效且不安全的,因此我试图将两者合并在一起。
Front end Repo: https://github.com/Tehsurfer/MPB前端仓库: https : //github.com/Tehsurfer/MPB
Back end Repo: https://github.com/Tehsurfer/Physiome-Blackfynn-API后端回购: https : //github.com/Tehsurfer/Physiome-Blackfynn-API
Since you said it was a valid answer, you could check the following question , where people explain ways to redirect subdomains to a different port on the same server.既然你说这是一个有效的答案,你可以检查以下问题,其中人们解释了将子域重定向到同一服务器上不同端口的方法。
A valid way to do this (mentioned in one of the answers) is to use name-based virtual hosts .一种有效的方法(在其中一个答案中提到)是使用基于名称的虚拟主机。 That way, you have the clean urls, and Apache manages the ports.这样,您就有了干净的 url,并且 Apache 管理端口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.