
本文共 2356 字,大约阅读时间需要 7 分钟。
Flask���Apache���Windows������������������
1. ������
Flask���������������������Python Web���������������������������������������������������������Web������������������������������������������������Flask������������Apache���WSGI���������������Apache���������������������Web���������������������������Flask������WSGI������������������������������������������������������������������
2. ������������
���������������������������������������������������������������������������
1. ������Python
- ���������������������������������Python 3.5.4���
- ���������������������������������Python������������������������
2. ������Flask
- ������pip���������������������
pip install flask
3. ������Apache
- ���������������Apache 2.4.x���������
- ������Apache������������������������������������������
Define SRVROOT "D:/Apache24"
- ���������������Apache���
httpd -k start
- ������
http://localhost/
������������������������
4. ������mod_wsgi
- ���������Python 3.5.4���������mod_wsgi���������������������������������������������������
httpd.conf
������ - ������������������mod_wsgi���������
mod_wsgi-express module-config
- ������������ reloadApache���������
3. ������������������
������������������������������
1. mytest.py
from flask import Flaskapp = Flask(__name__)@app.route('/mytest')def mytest(): return 'Hello World. ���������������������������'if __name__ == '__main__': app.run()
2. mytest.wsgi
import syssys.path.insert(0, "D:/mytest")from mytest import appapplication = app
4. Apache������������������
���httpd.conf
������������������������
ServerName mytest.com WSGIScriptAlias / D:/mytest/mytest.wsgi Require all granted
- ������������������������������������������������������������
/mytest
������������������������
5. ������������
- restart Apache���
- ���������������������
http://localhost(mytest)/
���������������������"Hello World. ���������������������������"���
������������
������������������������������������Flask-WSGI-Apache������������������Apache Werkzeug������������������������������������������������������������
������������
- ������������
httpd.conf
������������WSGIScriptAlias
���Directory
��������� - ������������������������������������������������Console������������������������������
���������������������������������������Flask���������������������Apache������������������������������������������������������������
发表评论
最新留言
关于作者
