自定义一个 zope3 的 Python 2.5 开发环境
----------------------------
LinFeiYu 2009,10,10
1. 创建一个自定义环境的目录::
$ sudo mkdir /opt/py25
$ sudo chown your_login_name:your_login_name /opt/py25
2. 首先需要自己编译一个 zlib 库
参照 limodou 前辈的文章 ( 编译Python 2.5.4带zlib http://www.zeuux.com/blog/content/1553/ ) ::
$ tar xzvf zlib-1.2.3.tar.gz
$ cd zlib-1.2.3
$ ./configure --prefix=/opt/py25 --shared
$ make
$ make install
$ make clean
3. 然后开始编译 Python 2.5.4
这里的 configure 是从 http://aur.archlinux.org/packages/python25 的 PKGBUILD 抄来的,呵呵 ::
$ tar xzvf Python-2.5.4.tgz
$ cd Python-2.5.4
$ ./configure --prefix=/opt/py25 --enable-shared --with-threads --enable-unicode
$ make
$ make install
$ make clean
4. 设置 Python 2.5 库
如果你的操作系统中已经存在一个二进制的 Python 2.5 的话,你可能不需要这一步了。
检查是否存在 /usr/lib/libpython2.5.so ,如果没有的话 ::
$ sudo ln -s /opt/py25/lib/libpython2.5.so.1.0 /usr/lib/libpython2.5.so
注意:这个方法可能不大好,如果你有好的方法,请告诉我。
5. 安装 setuptools
::
$ tar xzvf setuptools-0.6c9.tar.gz
$ cd setuptools-0.6c9
$ /opt/py25/bin/python setup.py install
$ /opt/py25/bin/python setup.py clean
7. 安装 zc.buildout
同上。
8. 一些可能用到的 Python 包的安装
基本思路同上。比如 PIL, ReportLab, xapian-bindings 等。
2009年10月15日星期四
2009年8月31日星期一
Python Web Framework
Python Web Framework
---------------------------
LinFeiYu 2009,08,30
感觉 Python web 框架都在向 zope 方向进展。这是最近发现的一个地方。为什么呢?
zope 中有一个叫做注册表的东西,这个注册表分为本地注册表和全局注册表(globalSiteManager),所有的组件不是在本地注册表中就是在全局注册表中,可以通过 Python 代码方式将组件注册到注册表,也可以通过 zcml 文件直接注册组件。虽然有人跟我说过 zcml 中注册的组件是注册到全局注册表中,然而在我学习了 wsgi 中间件之间的调用之后,我发现那个说法应该是错误的。 zcml 中的组件注册应该只是注册到本地注册表,而不是注册到全局注册表!如果开发一个大型的应用的话,每个模块都有其组件注册到注册表上,这样 zope 的注册表将是非常的大的。在 zope组件架构 ( http://www.muthukadan.net/docs/zca.html#adapters ) 中提到:“局部组件是持久化组件,而全局组件是保存在内存之中。全局组件是根据应用的设置进行注册的,而局部组件是在应用启动的时候从数据库中加载到内存的。” 我想这个跟 Windows 的注册表有些神似,不过却不是真正的好方案,Windows 的注册表已经被批得一塌糊涂,比如《Unix编程艺术》中所指出的那样。使用 zcml 配置文件据说也是很多 Python 开发者拒绝 zope 的一个原因。
Django 的发展中也许遇到了类似的问题,它们必须把组件组装到一个地方,让整个框架可以方便地统一管理这些组件。于是,我们看到了 Django 的 admin 模块中也出现了一个类似注册表的东西,这篇文章中: 修正 Django Step by Step 的一些例子 ( http://www.vpsee.com/2009/07/update-examples-in-django-step-by-step/ ) 指出了这个问题。毫无疑问,注册表功能将会在 Django 中越来越多的出现,最后可能走向 zope 的注册表解决方案。
国内 Python 领袖人物之一的 limodou 在其尚未开发完成的 Uliweb 框架中更是使用了一种非常类似 zcml 的解决方案,不同的是作者使用的是 ini 配置文件。具体介绍看这里:第一章 Uliweb介绍 ( http://sites.google.com/site/learninguliweb/home/chapter1 ) 中的 “资源共享的处理方式” 一段。在资源的配置上它应该还没有做到 zope 中那样可以根据 weight 来调整合并资源文件的深度。更不用说 zope 的 viewlet 那样灵活的设计了。
总之,在这些或者非常火爆,或者尚在发展的轮子中,我们还是看到已经存在的设计,或许他们重新造轮子只是想把原来的设计简化而已。。。
今天,无意中看到同事 Youngking 很久以前的一篇文章:又一个框架-bobo ( http://blog.xmu.me/2009/06/14/framework-bob/ ),发表时间是 2009,06,14 ,而文章最后一句话,“这个框架目前还没有正式发布,Jim Fulton声称会在下周一发布。”估计这个东西已经出来很久了,那么有时间一定要去弄来玩玩,或许它带来了很多新的东西。呵呵 :-)
---------------------------
LinFeiYu 2009,08,30
感觉 Python web 框架都在向 zope 方向进展。这是最近发现的一个地方。为什么呢?
zope 中有一个叫做注册表的东西,这个注册表分为本地注册表和全局注册表(globalSiteManager),所有的组件不是在本地注册表中就是在全局注册表中,可以通过 Python 代码方式将组件注册到注册表,也可以通过 zcml 文件直接注册组件。虽然有人跟我说过 zcml 中注册的组件是注册到全局注册表中,然而在我学习了 wsgi 中间件之间的调用之后,我发现那个说法应该是错误的。 zcml 中的组件注册应该只是注册到本地注册表,而不是注册到全局注册表!如果开发一个大型的应用的话,每个模块都有其组件注册到注册表上,这样 zope 的注册表将是非常的大的。在 zope组件架构 ( http://www.muthukadan.net/docs/zca.html#adapters ) 中提到:“局部组件是持久化组件,而全局组件是保存在内存之中。全局组件是根据应用的设置进行注册的,而局部组件是在应用启动的时候从数据库中加载到内存的。” 我想这个跟 Windows 的注册表有些神似,不过却不是真正的好方案,Windows 的注册表已经被批得一塌糊涂,比如《Unix编程艺术》中所指出的那样。使用 zcml 配置文件据说也是很多 Python 开发者拒绝 zope 的一个原因。
Django 的发展中也许遇到了类似的问题,它们必须把组件组装到一个地方,让整个框架可以方便地统一管理这些组件。于是,我们看到了 Django 的 admin 模块中也出现了一个类似注册表的东西,这篇文章中: 修正 Django Step by Step 的一些例子 ( http://www.vpsee.com/2009/07/update-examples-in-django-step-by-step/ ) 指出了这个问题。毫无疑问,注册表功能将会在 Django 中越来越多的出现,最后可能走向 zope 的注册表解决方案。
国内 Python 领袖人物之一的 limodou 在其尚未开发完成的 Uliweb 框架中更是使用了一种非常类似 zcml 的解决方案,不同的是作者使用的是 ini 配置文件。具体介绍看这里:第一章 Uliweb介绍 ( http://sites.google.com/site/learninguliweb/home/chapter1 ) 中的 “资源共享的处理方式” 一段。在资源的配置上它应该还没有做到 zope 中那样可以根据 weight 来调整合并资源文件的深度。更不用说 zope 的 viewlet 那样灵活的设计了。
总之,在这些或者非常火爆,或者尚在发展的轮子中,我们还是看到已经存在的设计,或许他们重新造轮子只是想把原来的设计简化而已。。。
今天,无意中看到同事 Youngking 很久以前的一篇文章:又一个框架-bobo ( http://blog.xmu.me/2009/06/14/framework-bob/ ),发表时间是 2009,06,14 ,而文章最后一句话,“这个框架目前还没有正式发布,Jim Fulton声称会在下周一发布。”估计这个东西已经出来很久了,那么有时间一定要去弄来玩玩,或许它带来了很多新的东西。呵呵 :-)
2009年4月4日星期六
grok似乎过于依赖zc.buildout
就算是用 virtualenv 来配置 grok 的运行环境,grok 还是要以 zc.buildout 的方式来管理包。
真是顽固!
真的看不到 grok 的希望,这个东西恐怕可以忽略了。。。。。
真是顽固!
真的看不到 grok 的希望,这个东西恐怕可以忽略了。。。。。
2009年3月4日星期三
zope2 现在可以通过easy_install安装了
http://regebro.wordpress.com/2009/02/27/zope-2-now-in-egg-form/
Zope 2.12 alpha 1 has been released. It’s completely “eggified”, meaning that all parts of it are separate python modules, installable with setuptools easy_install command. The main egg is called just Zope2, and you can therefore now install Zope 2 with “easy_install Zope2″ from the command line. Of course, this will install it in the system library, which is probably not what you want. So you probably want to use virtualenv to create a separate installation, or use buildout.
Here are the commands I used to test this alpha version:
virtualenv zope212 # Create a python sandbox for testing
cd zope212
bin/easy_install Zope2 # Install Zope 2
# make coffee while Zope 2 gets downloaded and installed
bin/mkzopeinstance
cd testinstance # Or whatever you called it
bin/zopectl fg
Yeah, that’s it! Works like a charm. Even on Python 2.6! Zope 2.12 will be released probably around a similar time as Plone 4. Plone 3.2 is already completely eggyfied, but Plone buildouts still need to have special recipies for installing Zope 2. With Zope 2.12 this will no longer be necessary, and you can install Plone just by doing an easy_install Plone, and get all of the parts installed. Which is totally cool!
So thanks to everyone involved in this, and also to everyone involved in eggifying Zope3, without which this never could have happend!
Posted in python, zope Tagged: eggs, plone
==============================
这是一个好消息!
赶快试下。。。
希望能工作在 python2.5 和 python2.6 上。哈哈
不要像不久前发布的 zope 3.4.0 那样,一上来就只认 python 2.4
PyPi 上的说明:
http://pypi.python.org/pypi/Zope2/
Zope 2.12 alpha 1 has been released. It’s completely “eggified”, meaning that all parts of it are separate python modules, installable with setuptools easy_install command. The main egg is called just Zope2, and you can therefore now install Zope 2 with “easy_install Zope2″ from the command line. Of course, this will install it in the system library, which is probably not what you want. So you probably want to use virtualenv to create a separate installation, or use buildout.
Here are the commands I used to test this alpha version:
virtualenv zope212 # Create a python sandbox for testing
cd zope212
bin/easy_install Zope2 # Install Zope 2
# make coffee while Zope 2 gets downloaded and installed
bin/mkzopeinstance
cd testinstance # Or whatever you called it
bin/zopectl fg
Yeah, that’s it! Works like a charm. Even on Python 2.6! Zope 2.12 will be released probably around a similar time as Plone 4. Plone 3.2 is already completely eggyfied, but Plone buildouts still need to have special recipies for installing Zope 2. With Zope 2.12 this will no longer be necessary, and you can install Plone just by doing an easy_install Plone, and get all of the parts installed. Which is totally cool!
So thanks to everyone involved in this, and also to everyone involved in eggifying Zope3, without which this never could have happend!
Posted in python, zope Tagged: eggs, plone
==============================
这是一个好消息!
赶快试下。。。
希望能工作在 python2.5 和 python2.6 上。哈哈
不要像不久前发布的 zope 3.4.0 那样,一上来就只认 python 2.4
PyPi 上的说明:
http://pypi.python.org/pypi/Zope2/
订阅:
博文 (Atom)
