Here is the tutorial:
1. Install Apache2.2
Please refer to other article!
2. Install mod_python
Please go to mod_python site to download the compatible version, then install it.
After the installation, a module named "mod_python.so" will be added to modules folder in Apache root.
3. Install python2.5
Please go to python site to download the python, then install it.
4. Install django-1.1.1
Please go to django site to download the django-1.1.1, then move to Python's site-packages folder.
5. Create the website
I just add a workspace under the D:, and start a project named "mycompany".
The folder structure seems like:
D:/djworkspace/mycompany
6. Edit httpd.conf of Apache to run the django.
a) Enable the mod_python, just add below segment:
##########################################################################
# Load Python Module
LoadModule python_module modules/mod_python.so
##########################################################################
b) Setup website
<VirtualHost *:84>
DocumentRoot "D:/djworkspace/mycompany/"
# Serve django pages
<LocationMatch ^/(.*)$>
SetHandler mod_python
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mycompany.settings
PythonOption django.root
PythonAutoReload Off
PythonDebug On
PythonPath "sys.path + ['D://djworkspace', 'D://djworkspace//mycompany']"
</LocationMatch>
# Serve static media without running it through mod_python (overrides the above)
<LocationMatch ^(/(media|css|images|scripts|errordocs))>
SetHandler None
</LocationMatch>
<Directory "D:/djworkspace/mycompany/">
Order allow,deny
Options Indexes
Allow from all
</Directory>
</VirtualHost>
7. Run the site
本文档提供了一套详细的步骤来安装并配置Apache、mod_python、Python及Django,以便搭建和运行一个基本的Django网站。包括安装所需软件、设置Apache以支持Django应用程序、配置虚拟主机等内容。
789

被折叠的 条评论
为什么被折叠?



