1. Create mysite test site: django-admin.py startproject mysite
2. Create a test page: hello. py. The content is as follows:
From django. http import HttpResponse
Def index (request ):
Return HttpResponse ('hello, Django! ')
3. Create the mod_py_dj.conf configuration file. The content is as follows:
LoadModule python_module modules/mod_python_so.pyd
Listen 8081.
Namevirtualhost*: 8081
<VirtualHost *: 8081>
<Location "/">
SetHandler python-program
PythonPath "['d: \ open \ www '] + sys. path"
PythonHandler django. core. handlers. modpython
SetEnv DJANGO_SETTINGS_MODULE mysite. settings
PythonAutoReload Off
PythonDebug On
</Location>
</VirtualHost>
Note: In this VirtualHost, you do not need to configure DocumentRoot; otherwise, add the following:
<Directory "d: \ open \ www">
Options FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
</Directory>
Do not configure DocumentRoot. Reduce the configuration.
4. Modify the url. py file and add a line:
(R' ^ hello/$ ', 'mysite. hello. Index ')
5. Test: http: // localhost: 8081/hello/