1. Download Apache Zip package decompression, placed in the C packing directory, cmd command switch to apache24/bin directory, enter command httpd-k install, httpd-k uninstall remove installation
C:\apache24\bin>httpd-k Install
Installing the ' Apache2.4 ' service
The ' Apache2.4 ' service is successfully installed.
Testing httpd.conf ....
Errors reported here must is corrected before the service can be started.
Description of successful installation, http://localhost in browser input will show it Works, indicating successful installation
2 Download the Mod_wsgi.whl file that corresponds to the Python version, pip install MOD_MSGI.WHL (note the path)
Go to Python's scripts path in cmd input mod_wsgi-express module-config
PS c:\users\user\appdata\local\programs\python\python36\scripts> mod_wsgi-express Module-config
LoadFile "C:/users/user/appdata/local/programs/python/python36/python36.dll"
LoadModule Wsgi_module "c:/users/user/appdata/local/programs/python/python36/lib/site-packages/mod_wsgi/server/ Mod_wsgi.cp36-win_amd64.pyd "
Wsgipythonhome "C:/users/user/appdata/local/programs/python/python36"
Copy the bold three words, paste the htppd.conf file to the end of the apache/conf
3 Create a wsgi.py file
Write
Import sys, OS
# My project is under the ' C:/users/user/desktop/flask_news
#Expand Python classes path with your app ' s path
Sys.path.insert (0, ' c:/users/user/desktop/flask_news ')
From Flask_news Import app
#Put Logging code (and imports) here ...
#Initialize WSGI App Object
application = App
4 Add the htppd.conf file at the end of the apache/conf
My port has been changed to 8081
<virtualhost *:8081>
ServerAdmin [email protected]
Wsgiscriptalias/app c:\mydir\wsgi.py
Path to #对应wsgi. py
<directory c:\mydir>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
5.cmd (Admin) switch both Apache bin directory execution httpd-k Uninstall, httpd-k install, net Sart Apache2.4
6. Browser Input http://localhost:8081/app/
Flask Apache Deployment