Recently, I found that many tutorials are built on linux. windows seems to be not a perfect place, but I am still willing to try it. The following article describes how to install and build django1.10.3 and Apache2.4 on Windows 10. For more information, see the following. Recently, I found that many tutorials are built on linux. windows seems to be not a perfect place, but I am still willing to try it. The following article describes how to install and build django1.10.3 and Apache2.4 on windows 10. For more information, see the following.
Environment introduction
Python3.5.2 64-bit
Django 1.10.3
Apache 2.4 64-bit
Windows 10
Focus on apache.
Python and django are believed to be interested in reading this article.
Install Apache2.4
Address: www.apachelounge.com/download/
Download: vc_redist.x64.exe to directly install vc_redist_x64/86.exe.
Download: httpd-2.4.17-win64-VC14.zip
Add D: \ Apache24 \ bin to the environment variable path;
Decompress the package to the specified directory to modify the configuration file: http. conf (change ServerRoot in the following content to your own actual Apche decompression path)
ServerRoot "D:/Apache24 "...... Listen 127.0.0.1: 8081 # Modify the port number ...... ServerName www.example.com: 8081 ...... DocumentRoot "D:/Apache24/htdocs"
...... ScriptAlias/cgi-bin/"D:/Apache24/cgi-bin /"......
AllowOverride None Options None Require all granted
Start the apache service:
cmd>httpd
127.0.0.1: 8081/index.html
It works! Apache configuration successful
Install mod_wsgi
First install:pip install wheel
Installmod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl
Download:mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl
Address: www.lfd.uci.edu /~ Gohlke/pythonlibs/# mod_wsgi
Pip installation:pip install mod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl
Configure Apache2.4, mod_wsgi, and django project
1. Copy C: \ Python35 \ mod_wsgi.so to D: \ Apache24 \ modules.
(Mod_wsgi.so onlymod_wsgi-4.4.23+ap24vc14-cp35-cp35m-win_amd64.whl
Can be found only after installation is successful)
2. modify the http. conf file of apache2.4:
# Add mod_wsgi.so module LoadModule wsgi_module modules/mod_wsgi.so
3. configure the django project to modify http. conf
# Add mod_wsgi.so module LoadModule wsgi_module modules/mod_wsgi.so # specify the static resource path Alias/statics/F:/pydj/newsCollection/toutiao/statics/
Require all granted
# Specify the wsgi. py configuration file path of the newsCollection project WSGIScriptAlias/F:/pydj/newsCollection/wsgi. py # specify the Project path WSGIPythonPath F:/pydj/newsCollection
Require all granted
Wsgi. py content:
import osos.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings")from django.core.wsgi import get_wsgi_applicationapplication = get_wsgi_application()
Configure the django project setting. py
ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
Finally tell a little Apche startup error will log, httpd-2.4.23-x64-vc14-r3 \ Apache24 \ logs directory error information, slowly troubleshooting
Summary
The above is the detailed tutorial for installing and constructing django1.10.3 and Apache2.4 in Windows 10. For more information, see other related articles in the first PHP community!