How to install Django
Downloading these software and then installing them as follow:
python: http://www.python.org/ftp/python/2.4.3/python-2.4.3.msi
PIL for py2.4: http://www.pythonware.com/products/pil/
Django: http://media.djangoproject.com/releases/0.95/Django-0.95.4.tar.gz
apache: http://apache.justdn.org/httpd/binaries/win32/apache_2.0.58-win32-x86-no_ssl.msi
mod_python: http://apache.justdn.org/httpd/modpython/win/3.2.8/mod_python-3.2.8.win32-py2.4.exe
you can also find them as attachments in this page.
Entering Django-0.95.4 directory
Using 'python ez_setup.py' command to check whether 'setuptool' is existent or not, if it is not existent, then it will download automatically from internet.
Then installing Django
Using 'python setup.py install' command to install Django to site-package directory and configure the sys.path file.
You can also check it out in terminal using:
import sys
print sys.path
Checking 'mod_python.so' out in 'D:\Program Files\Apache Group\Apache2\modules' directory
Modifying appach conf/httpd.conf file
Adding following things:
'LoadModule python_module modules/mod_python.so'
<Directory "D:/Program Files/Apache Group/Apache2/htdocs/test">
AddHandler mod_python .py
PythonHandler pythonTest
PythonDebug On
</Directory>
Creating a ‘pythonTest.py’ file in the test directory, like this(paying more attention on code formatting):
from mod_python import apache def handler(req): req.content_type = 'text/plain' req.write("Hello World!\n") return apache.OK
Restart appach
Using following address:
http://127.0.0.1/test/pythonTest.py
'Hello World!' appears on the page.
Next, creating a django project.
Entering D:\Program Files\Python24\Scripts directory
Using 'django-admin.py startproject newtest' command to create a new django project.
Cutting the newtest directory and then pasting in D:\Program Files\Python24\Lib\site-packages directory
Modifying appach conf/httpd.conf file
<Location "/newtest/">
SetHandler python-program
PythonPath "sys.path+['D:/Program Files/Python24/Lib/site-packages/newtest']"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE newtest.settings
PythonDebug On
</Location>
Restart appach
Using following address:
http://127.0.0.1/newtest/
It works!
LOL