//安装时的一些信息,贴在这里吧
Win2003
Apache /2.2.4
Django-0.96.1 框架
Python 2.5
Mod_python mod_python-3.3.1.win32-py2.5-Apache2.2.exe
MySQL_python-1.2.2-py2.5-win32
注意:
Django-0.95.2 (DEFAULT_VERSION = "0.6c3") 在用此版本时需更改 ez_setup.py 文件中的此处
pythonWin 2.5.1 编辑器
mod_python 安装
通 过在 Apache 的配置文件 ( 通常称为 httpd.conf 或者 apache.conf) 里面加入如下一行,来载入模块:
LoadModule python_module libexec/mod_python.so
A
<Directory /some/directory/htdocs/test>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>
测试文件
from mod_python import apache
def handler(req):
req.write("Hello World!")
return apache.OK
将你的浏览器指向 mptest.py 所在的 URL; 你将会看到 "Hello World!".
B
<Directory "E:/php/AppServ/www">
AllowOverride FileInfo
AddHandler mod_python .py
PythonDebug On
SetHandler mod_python
PythonHandler mod_python.publisher
</Directory>
测试页面前台
<html>
请填写下面的回馈表单 :
<form action="form.py/email" method=" POST">
用户名 :
<input type="text" name="name"><br>
电子邮件 :
<input type="text" name="email"><br>
意见 :
<textarea name="comment" rows=4 cols=20></textarea><br>
<input type="submit">
<body> <a href="./form2.html" target=_blank> 第二首页 </a>
<a href="./form2.html" > 第三首页 </a>
</form>
</html>
测试页面后台
from mod_python import apache
def email(req,comment="NOTHING",name ="1",email="2"):
return "I am saying %s" % name + "I am saying %s"%email + "I am saying % s"%comment
注意:不要输出 tuple 只输出单个变量就不会出现 unicode
二者似乎不可共存 , 原因未知
Django-0.96.1 安装:
Django-0.96.1.tar 解压
运行里面的 setup.py
Cmd ->python setup.py install( 相应文件夹 )
Cmd -> django-admin.py startproject website ( 比如 E: )
C md ->E:/website>python manage.py runserver (启此服务)
查看 http://localhost:8000/页面 有成功的提示 “It worked!”
修改 urls.py
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.apps.foo.urls.foo')),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)
注意:在应用 0.95.2 版本时出现此错误
'function' object has no attribute 'rindex'
Win2003
Apache /2.2.4
Django-0.96.1 框架
Python 2.5
Mod_python mod_python-3.3.1.win32-py2.5-Apache2.2.exe
MySQL_python-1.2.2-py2.5-win32
注意:
Django-0.95.2 (DEFAULT_VERSION = "0.6c3") 在用此版本时需更改 ez_setup.py 文件中的此处
pythonWin 2.5.1 编辑器
mod_python 安装
通 过在 Apache 的配置文件 ( 通常称为 httpd.conf 或者 apache.conf) 里面加入如下一行,来载入模块:
LoadModule python_module libexec/mod_python.so
A
<Directory /some/directory/htdocs/test>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>
测试文件
from mod_python import apache
def handler(req):
req.write("Hello World!")
return apache.OK
将你的浏览器指向 mptest.py 所在的 URL; 你将会看到 "Hello World!".
B
<Directory "E:/php/AppServ/www">
AllowOverride FileInfo
AddHandler mod_python .py
PythonDebug On
SetHandler mod_python
PythonHandler mod_python.publisher
</Directory>
测试页面前台
<html>
请填写下面的回馈表单 :
<form action="form.py/email" method=" POST">
用户名 :
<input type="text" name="name"><br>
电子邮件 :
<input type="text" name="email"><br>
意见 :
<textarea name="comment" rows=4 cols=20></textarea><br>
<input type="submit">
<body> <a href="./form2.html" target=_blank> 第二首页 </a>
<a href="./form2.html" > 第三首页 </a>
</form>
</html>
测试页面后台
from mod_python import apache
def email(req,comment="NOTHING",name ="1",email="2"):
return "I am saying %s" % name + "I am saying %s"%email + "I am saying % s"%comment
注意:不要输出 tuple 只输出单个变量就不会出现 unicode
二者似乎不可共存 , 原因未知
Django-0.96.1 安装:
Django-0.96.1.tar 解压
运行里面的 setup.py
Cmd ->python setup.py install( 相应文件夹 )
Cmd -> django-admin.py startproject website ( 比如 E: )
C md ->E:/website>python manage.py runserver (启此服务)
查看 http://localhost:8000/页面 有成功的提示 “It worked!”
修改 urls.py
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.apps.foo.urls.foo')),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)
注意:在应用 0.95.2 版本时出现此错误
'function' object has no attribute 'rindex'