在服务器上部署多个Flask应用

时间:2020-01-20 19:21:00

标签: apache flask localhost virtualhost wsgi

我正在尝试将第二个烧瓶应用程序部署到apache网络服务器。我已为127.0.0.1:8868在httpd.conf文件中添加了第二个侦听器,因为我正在通过位于计算机上的网关访问api。我部署的第一个应用程序以非常相似的方式设置,并且运行完美。从.py文件启动时,flask应用程序可以正常运行。我随附了httdpd.conf文件,httpd-vhosts.conf文件和web.wsgi文件的摘录。它不会在apache错误日志和/或访问日志中记录任何错误。如果.wsgi文件中有错误,它将记录在访问和错误日​​志中。同时启用两个侦听器似乎也会干扰第一个在端口5000上侦听的应用程序。

httpd侦听器:

Listen 127.0.0.1:5000
Listen 127.0.0.1:8868

httpd-vhosts.conf:

<VirtualHost *:5000>
        WSGIScriptAlias / C:/Users/me/web_apps/task_manager/app/index/web.wsgi
        <Directory C:/Users/me/web_apps/task_manager>
            Require all granted
        </Directory>
</VirtualHost>

<VirtualHost *:8868>
        WSGIScriptAlias / C:/Users/me/web_apps/template_autoupdate/app/index/web.wsgi
        <Directory C:/Users/me/web_apps/template_autoupdate>
            Require all granted
        </Directory>
</VirtualHost>

web.wsgi

import sys

sys.path.insert(0, "C:/Users/me/web_apps/template_autoupdate/app")

from autoupdater import app as application

0 个答案:

没有答案