简体   繁体   English

使用mod_wsgi和WinSCP在Apache服务器上部署Flask应用

[英]Deploy Flask app on Apache Server using mod_wsgi and WinSCP

I want to deploy my Flask application on an Apache server. 我想在Apache服务器上部署Flask应用程序。 I have an account on the server, and have been told that "The server can be used to run scripts and web apps written in Python (using django and mod_wsgi)". 我在服务器上有一个帐户,并被告知“该服务器可用于运行用Python编写的脚本和Web应用程序(使用django和mod_wsgi)”。

I am on Windows, and to transfer files I have to use an FTP client - so I am using WinSCP. 我在Windows上,要传输文件,我必须使用FTP客户端-所以我在使用WinSCP。

Installing mod_wsgi is not as straightforward as I expected and I cannot get any clear documentation online. 安装mod_wsgi并不像我期望的那么简单,并且我无法在线获得任何清晰的文档。

Because the server can already run Python scripts using mod_wsgi does that mean that I just have to create a .wsgi file or do I still need to download it? 因为服务器已经可以使用mod_wsgi运行Python脚本,这是否意味着我只需要创建一个.wsgi文件,还是仍然需要下载它? I don't know how to go about this. 我不知道该怎么办。

First you need to check if mod_wsgi is really enabled on the server, then you have to check how your virtual host is configured in apache. 首先,您需要检查是否在服务器上确实启用了mod_wsgi,然后必须检查如何在apache中配置虚拟主机。 There you will find the name you have to give to the wsgi file. 在这里,您将找到必须给wsgi文件指定的名称。

If you have shell access to the server you can do that by using the following commands: 如果您具有对服务器的Shell访问权限,则可以使用以下命令进行访问:

Check mod_wsgi: 检查mod_wsgi:

sudo apache2ctl -t -D DUMP_MODULES | grep wsgi

Check what name the .wsgi file should have: 检查.wsgi文件应具有的名称:

sudo grep WSGIScriptAlias /etc/apache2/sites-enabled/yoursite.conf

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM