配置mod_python


1.使用apache_2.0.54-win32-x86-no_ssl.msi
http://archive.apache.org/dist/httpd/binaries/win32/

2.安装mod_python-3.2.8.win32-py2.4.exe
http://apache.justdn.org/httpd/modpython/

mod_python中文文档
http://man.chinaunix.net/develop/python/mod_python/mod_python.h

3.配置Apache2\conf\httpd.conf

添加
LoadModule python_module modules/mod_python.so

<Directory "D:/Apache Group/Apache2/htdocs">
        AddHandler mod_python .py
        PythonHandler mptest
        PythonDebug On
</Directory>

4.浏览http://localhost:8080/mptest.py,测试mod_python是否配置成功

配置Django


http://thinkhole.org/wp/2006/04/03/django-on-windows-howto/
Django Step by Step

1.http://tortoisesvn.sourceforge.net/ 下载tortoisesvn
签出http://code.djangoproject.com/svn/django/trunk/django
Copy django 到 E:\Python24\Lib\site-packages\
Copy E:\Python24\Lib\site-packages\django\bin\django-admin.py 到 E:\Python24\Scripts

2.通过shell,运行import django,如果成功运行,证明安装成功

3.创建Web项目,路径E:\mysite
先添加环境变量,Path=E:\Python24\;E:\Python24\Scripts;
建议添加PATHEXT=.py
django-admin.py 就可以不带扩展名执行

E:\mysite>django-admin.py startproject mysite

生成了一个mysite目录,包含__init__.py, manage.py, settings.py, urls.py
__init__.py 说明mysite是一个python包
manage.py 管理应用程序
settings.py 配置应用程序
urls.py URL映射


E:\mysite>python manage.py runserver

查看http://localhost:8000/页面

4.配置到Apache

<Location "/mysite/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonPath "['E:\mysite'] + sys.path"
    PythonDebug On
</Location>

<Location "/media/">
    SetHandler None
</Location>

<LocationMatch "\.(jpg|gif|png)$">
    SetHandler None
</LocationMatch>

浏览http://localhost:8080/mysite/

5.安装数据库
postgresql
http://wwwmaster.postgresql.org/download/mirrors-ftp?file=binary%2Fv8.1.3%2Fwin32%2Fpostgresql-8.1.3-1.zip

SQLite
http://www.sqlite.org/download.html

pysqlite
http://www.initd.org/tracker/pysqlite

posted on 2006-05-12 13:56  Rover  阅读(2845)  评论(0编辑  收藏  举报