All of the things that have just been learned about Django will be configured here. Here I simple second speed a fool step, make everyone easier to get started.
First, the Environment preparation
1, Windows 32 system is at least XPSP3 version, note; apache2. X does not support the following versions of Windows 98, ME or NT 4.0
2. Download software
apache2.4: because Apache does not compile version 2.4 of Windows, it wants to compile itself. Then we download the 32 version of Apache from Apache House, note that the VC11 version does not support XP and 2003. My is Windows 7 32-bit, if you and my system like, congratulations:), please click here to download directly.
Reference: HTTP://WWW.APACHEHAUS.COM/CGI-BIN/DOWNLOAD.PLX
django1.6: in order to facilitate everyone to download from the official website, please click here.
Reference: https://www.djangoproject.com/download/
python3.3: to facilitate everyone to download from the official website, click here (32bit)
Reference: http://www.python.org/download/
wsgi3.4: same, corresponding to the 32-bit version of Python3.3 and apache2.4, click here to download
Reference: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
Second, installation
python3.3: Click on the downloaded Python installation package and I'll install it to "C:\python33\" by default.
Environment variable configuration:
Mode 1:
Start Menu =〉 run: CMD
Command line input: set path=%path%; C:\python33 Mode 2:
Edit the system environment variable: In the beginning, add: "C:\python33\;"
django1.6: I unzip the downloaded zip file to "E:\django1.6\"
1. Installation
Start Menu =〉 run: CMD
Command Line Input:
->e:->CD django1.6->python setup.py Install
Add environment variable: "C:\python33\Scripts\;" refer to python3.3 step
You can now delete the "E:\django1.6" folder.
2. Create a Django Project
My Django project folder "E:\django-project\"
->e:->cd django-project,django-admin.py startproject mysite
The following files were generated:
e:\django-project\mysite\ |---manage.py |---mysite\ |---__init__.py |---settings.py |---urls.py |---wsgi.py apache2.4: unzip the downloaded zip file. See the "Apahce24" folder and the "readme_first.html" file.
Copy to "E:\apache\"
Now "E:\apache\" has the following files
e:\apache\ |---readme_first.html |---apache24\
wsgi3.4: unzip the downloaded zip file. The resulting "mod_wsgi.so" file is copied to the "e:\apache\apache24\modules\" directory.
Third, the configuration
Apache Configuration
1. The "e:\apache\apache24\conf\http.conf" file is configured as follows:
# ServerRoot: Modify Srvroot to Define srvroot "E:/apache/apache24" # Listen: Change to the port number you want, mine is the Listen # Dynamic Shared Object (DSO) Suppo The last line at RT adds LoadModule wsgi_module modules/mod_wsgi.so # ServerName changed ports and you Listen consistent ServerName Localhos T:80
2. The "e:\apache\apache24\conf\extra\httpd-vhosts.conf" file is added at the end of the configuration as follows:
Wsgiscriptalias/"e:/django-project/mysite/mysite/wsgi.py" Wsgipythonpath "e:/django-project/ mysite/"<directory" e:/django-project/mysite/mysite/> allowoverride None Options None Require All granted </Directory>
Iv. Testing
Start Menu =〉 run: CMD
->e:->CD Apache->cd apache24->cd bin->httpd
In the browser input
http://localhost/
You should be able to see the Django page and hopefully it will be useful for everyone.
Windows Apache Django Configuration