【发布时间】:2020-04-02 12:04:30
【问题描述】:
如何在同一网络服务器和同一端口中运行烧瓶应用程序的多个实例?
目前我的烧瓶应用程序具有以下目录结构:
├── app
│ ├── __pycache__
│ ├── static
│ └── templates
├── instance
├── src
└── __pycache__
当应用程序开始使用flask run 时,它会在默认端口localhost:5000 上运行。
我能够创建应用程序的副本并在两个端口 5000 和 5001 上运行,并且运行良好。
但是,我只想使用一个带有 index.html 文件的服务器,其中
localhost:5000/index.html 有 2 个链接用于重定向到 app1 的 localhost:5000/app1/ 和 app2 的 localhost:5000/app2/
这是为了避免使用额外的端口。
我目前已将应用程序克隆到 app2,但不知道要运行两个应用程序。(以下是目录结构)
├── app
│ ├── __pycache__
│ ├── static
│ └── templates
├── app2
│ ├── __pycache__
│ ├── static
│ └── templates
├── instance
├── src
└── __pycache__
我还检查了如何使用蓝图,但据我了解,它们旨在用于不同的视图。
【问题讨论】: