2007年05月04日 星期五 01:05
http://maowuu.com 演示站点 需要使用到的组件 pyisapie,python2.5,vs2005,pywin32,django 0.96 大家自己去下载准备的说 首先依次安装python2.5和pywin32相应版本,这里没有什么说的。照着提示next就ok了。 然后解压缩pyisapie,进入source使用vs2005(我用的是这个,2003或者6应该也可以) 加载python.lib和python.h重新编译pyisapie。默认下载的pyisapie是使用python2.4编译的。 然后按照http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer中的说明去做。 拷贝pyisapie.dll的时候,使用自己编译的那个。 完毕了?别急,还需要修改文件pyisapie.py 第一个是 将response = This.get_response(Env.URL,request) 修改成如下 response = This.get_response(request) response.path = Env.URL 这个可以考虑不要了,在dj中response对象,并没有path属性。也没有相关需求。 然后将 #for chunk in http_response.iterator: # Write(chunk) Write(http_response.content) ok了,全部搞定,大家可以使用了。hoho。。。希望对大家有所帮助。 所有小提醒中的服务器中,都是指我们上边架设的iis+pyisapie的这个环境;其它环境是否存在此问题,我并没有验证。 小的提醒(1):django的urls.py中的规则都是从访问根目录开始的,也就是http://localhost/ 开始;如果你使用虚拟目录的话(例如:虚拟目录为python),你的规则中需要带上此虚拟目录。你的urls.py中的设定都应该是r'python/*'这样开始的。 小的提醒(2):在django的devolopment server中,模块加载路径会自动逐目录查找的,但是在iis中使用的时候则不会。例如:在使用django-tagging的时候, 其fields.py模块中的from tagging.validators import isTagList,在自带的开发server中使用是没有任何问题的,但是到了服务器上tagging.validators就会无法找到,必 须是projectname.tagging.validators才可以 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20070504/f431e23e/attachment.html
2007年05月04日 星期五 02:28
>
> 完毕了?别急,还需要修改文件pyisapie.py
> 第一个是
> 将response = This.get_response(Env.URL,request)
> 修改成如下
> response = This.get_response(request)
> response.path = Env.URL 这个可以考虑不要了,在dj中response对象,并没有path属性。也没有相关需求。
不需要 request.path = Env.URL 吗?不过既然你成功了,也许是不需要了。
> 然后将
> #for chunk in http_response.iterator:
> # Write(chunk)
> Write(http_response.content)
这里改成:
try:
for chunk in http_response:
Write(chunk)
finally:
http_response.close()
也许更合适,毕竟 response 是支持 iterator 的。
> 小的提醒(2):在django的devolopment
> server中,模块加载路径会自动逐目录查找的,但是在iis中使用的时候则不会。例如:在使用django-tagging的时候,
> 其fields.py模块中的from tagging.validators import
> isTagList,在自带的开发server中使用是没有任何问题的,但是到了服务器上tagging.validators就会无法找到,必
> 须是projectname.tagging.validators才可以
这个的原因应该是与当前目录有关,django 加载模块会从当前目录开始,执行 development server 的时候当前目录就是 project
的目录,所以 from tagging.validators import ... 时能够从当前目录找到模块,不过用 iis
时,当前目录不同了,所以只能从 sys.path 中的目录中找,项目的上一层目录在 sys.path 中,所以...
--
http://codeplayer.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070504/8b913996/attachment.html
2007年05月04日 星期五 03:34
谢谢补充,初学者的东西,让大家见笑了。
还有一个关于正则表达式的问题请教
tag_list_re = re.compile(r'^[-\w]+(?:(?:,\s|[,\s])[-\w]+)*$') #中文验证问题,还存在。
怎么给这个表达式中增加允许中文呢? 字母 ,数字,下滑线,中文
find_tag_re = re.compile('[-\w]+') #包含中文时候字符串截取问题,还没有解决。
这个是用来查找字符串中的字符的,将找到的结果放入一个list中,我想加入中文,应该怎么写?
这个就是用来解决django-tagging的中文问题,默认的django-tagging无法使用中文。需要修改以上两处,
分别在validators.py和utils.py中。
On 5/4/07, 黄毅 <yi.codeplayer at gmail.com> wrote:
>
> 完毕了?别急,还需要修改文件pyisapie.py
> > 第一个是
> > 将response = This.get_response(Env.URL,request)
> > 修改成如下
> > response = This.get_response(request)
> > response.path = Env.URL 这个可以考虑不要了,在dj中response对象,并没有path属性。也没有相关需求。
>
>
> 不需要 request.path = Env.URL 吗?不过既然你成功了,也许是不需要了。
>
>
> > 然后将
> > #for chunk in http_response.iterator:
> > # Write(chunk)
> > Write(http_response.content)
>
>
> 这里改成:
> try:
> for chunk in http_response:
> Write(chunk)
> finally:
> http_response.close()
>
> 也许更合适,毕竟 response 是支持 iterator 的。
>
>
> > 小的提醒(2):在django的devolopment
> > server中,模块加载路径会自动逐目录查找的,但是在iis中使用的时候则不会。例如:在使用django-tagging的时候,
> > 其fields.py模块中的from tagging.validators import
> > isTagList,在自带的开发server中使用是没有任何问题的,但是到了服务器上tagging.validators就会无法找到,必
> > 须是projectname.tagging.validators才可以
>
>
> 这个的原因应该是与当前目录有关,django 加载模块会从当前目录开始,执行 development server 的时候当前目录就是
> project 的目录,所以 from tagging.validators import ... 时能够从当前目录找到模块,不过用 iis
> 时,当前目录不同了,所以只能从 sys.path 中的目录中找,项目的上一层目录在 sys.path 中,所以...
>
>
>
> --
> http://codeplayer.blogspot.com/
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070504/970927c2/attachment.htm
Zeuux © 2025
京ICP备05028076号