Method of Apache for on line deployment of Django
- 2021-07-01 08:39:04
- OfStack
Environment:
1. Windows Server 2016 Datacenter 64-bit
2. SQL Server 2016 Enterprise 64-bit
3. Python 3.6. 0 64-bit
4. administrator user, no domain environment, highest authority
Requirements:
Deploy in sequence
1. Install the database
2. Install the database client "SSMS"
3. Install Python
4. Download apache2.4 (httpd-2. 4.41-win64-VC14. zip)
5. Unzip to the root directory of C and open cmd to execute: C:\ Apache24\ bin\ httpd.exe-k install
6. Download the compiled wsgi (mod_wsgi-4. 5.24+ap24vc14-cp36-cp36m-win_amd64. whl)
7. cmd execution: pip install "path"\ mod_wsgi-4. 5.24+ap24vc14-cp36-cp36m-win_amd64. whl
8. cmd execution: mod_wsgi-express module-config (execution result appended to "httpd. conf")
LoadFile "d:/programs/python/python36.dll"
LoadModule wsgi_module "d:/programs/python/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "d:/programs/python"
9. Revision of "httpd. conf"
Define SRVROOT "c:/Apache24"
ServerName " IP " :80
Include conf/extra/httpd-vhosts.conf (Uncomment)
10. Amend "extra/httpd-vhosts. conf" to read as follows:
<VirtualHost *:80>
ServerName "192.168.70.111"
DocumentRoot "${SRVROOT}/htdocs/MySite"
ErrorLog "logs/project-error.log"
CustomLog "logs/project-access.log" common
</VirtualHost>
Alias /media/ "${SRVROOT}/htdocs/MySite/media/"
<Directory "${SRVROOT}/htdocs/MySite/media/">
Require all granted
</Directory>
Alias /static/ "${SRVROOT}/htdocs/MySite/static/"
<Directory "${SRVROOT}/htdocs/MySite/static/">
Require all granted
</Directory>
WSGIScriptAlias / "${SRVROOT}/htdocs/MySite/project/wsgi.py"
<Directory "${SRVROOT}/htdocs/MySite/project/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
11. Start c:\ Apache24\ bin\ ApacheMonitor.exe
Summarize