我是Web开发和flask的新手,我正在尝试使用Apache24在Windows计算机上部署flask应用程序。我尝试遵循一些教程,但是仍然无法特别部署我的应用程序。在browssr中调用localhost以连接超时结束
我的Flask根文件夹C:\ core,我必须运行app.py才能启动服务
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 09/10/2019 13:01 .idea
d----- 09/10/2019 11:04 app
d----- 08/10/2019 17:04 logs
d----- 08/10/2019 12:01 venv
d----- 30/09/2019 17:08 __pycache__
-a---- 09/10/2019 11:33 89 app.py
-a---- 12/07/2019 11:06 419 config.py
-a---- 30/09/2019 17:24 429 requirements.txt
-a---- 09/10/2019 12:42 86 web.wsgi
启动服务的app.py
from app import app as application
if __name__ == '__main__':
application.run()
web.wsgi文件
import sys
sys.path.insert(0, 'C:/core')
from app import app as application
apache httpd.conf添加了配置
LoadFile "c:/users/user/appdata/local/programs/python/python37-32/python37.dll"
LoadModule wsgi_module "c:/core/venv/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win32.pyd"
WSGIPythonHome "c:/core/venv"
apache httpd-vhosts.conf配置
<VirtualHost *:80>
ServerName localhost
WSGIScriptAlias / "C:/core/web.wsgi"
DocumentRoot "C:/core"
<Directory "C:/core">
Require all granted
</Directory>
ErrorLog "C:/core/logs/error.log"
CustomLog "C:/core/logs/access.log" common
</VirtualHost>
当前,当我尝试访问localhost时,无法访问应用程序。 Apache服务已在Windows上成功启动。以前,在ElasticBeanstalk上成功部署服务是我的事,但是现在在Windows上需要它。不幸的是,我缺乏了解如何使其工作并需要一些建议。