Iam通过此链接“https://medium.com/@madumalt/flask-app-deployment-in-windows-apache-server-mod-wsgi-82e1cfeeb2ed”在windows中部署flask应用程序。。。。。。。。你知道吗
1)通常这是在我的http中-vhosts.conf文件文件:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "${SRVROOT}/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ServerAlias www.dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
下面我添加了服务器名、WSGIScriptAlias和目录,如下所示:
<VirtualHost *:80>
ServerName localhost
WSGIScriptAlias / "D:/Tirumalesh/dev/text_basic/web.wsgi"
DocumentRoot "D:/Tirumalesh/dev/text_basic"
<Directory D:/Tirumalesh/dev/text_basic>
Require all granted
</Directory>
</VirtualHost>
2)并且我在我的httpd.conf文件(在文件的最后)这是来自“mod\uwsgi-express module config”的输出,我已经包括了“Include conf/extra/httpd”-vhosts.conf文件“(虚拟主机)在我的httpd.conf文件文件
LoadFile "c:/users/lucid/anaconda3/python37.dll"
LoadModule wsgi_module "c:/users/lucid/anaconda3/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd"
WSGIPythonHome "c:/users/lucid/anaconda3"
3)接下来我创建一个网站.wsgi包含以下内容的文件
导入系统 系统路径插入(0,'D:\Tirumalesh\dev\text\u basic') 从文本\基本导入应用程序作为应用程序
4)我的python文件是“text”_基本.py“(其名称必须与我的.wsgi文件相同)
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return ("Hello World qwertyuiop!!")
if __name__ == "__main__":
app.run()
之后,我重新启动了我的apache服务器,并尝试运行“localhost”,但我没有得到“helloworld qwertyuiop!!”在我的html页面中的这个输出相反,我得到了“在这个服务器上找不到请求的URL/。
这里面有什么我遗漏的吗??你知道吗
注意:https://github.com/GrahamDumpleton/mod_wsgi/releases/download/4.4.12/mod_wsgi-windows-4.4.12.tar.gz
而不是下载这个“mod\u wsgi-windows-4.4.12”。焦油.gz“这个文件和寻找正确的模式_wsgi.so公司文件并将其复制到我的“C:\Users\lucid\VS16\Apache24\modules”并粘贴.so文件, 我使用“pip install mod \u wsgi”下载mod \u wsgi,然后运行“mod \u wsgi-express module config”并将下面的输出复制到httpd.conf文件在文件的最后一行。。。。。。。你知道吗
LoadFile "c:/users/lucid/anaconda3/python37.dll"
LoadModule wsgi_module "c:/users/lucid/anaconda3/lib/sitepackages/mod_wsgi/server/mod_wsgi.cp37-
win_amd64.pyd"
WSGIPythonHome "c:/users/lucid/anaconda3"
看起来您正在使用python3(3.7)和pip。 不要使用“pip install mod \u wsgi”,而是使用“pip3 install mod \u wsgi”并启用调试模式。你知道吗
相关问题 更多 >
编程相关推荐