用于repoze.zope2 + Plone的Sane建筑物

This is a follow-up to Martin Aspeli’s introduction to repoze and Plone from last year

这是去年以来Martin Aspeli对repoze和Plone的介绍的后续内容

两个建筑的故事 (A Tale of Two Buildouts)

There are two stories going on here, both of which Martin Aspeli recently described in great detail and Chris McDonough tackled last year. For the purposes of this blog entry, I’ll refer to the issue as the “index vs. find-links” conundrum in buildout  (find-links in buildout are equivalent to distribution_links in setuptools).

这里有两个故事, 最近都有马丁·阿斯佩利(Martin Aspeli)详细描述, 去年 则由 克里斯·麦克唐纳Chris McDonough)处理 。 出于本博客条目的目的,我将把这个问题称为构建中的“索引与查找链接”难题(构建中的查找链接等同于setuptools中的distribution_links)。

For those that want strict repeatability, using the index parameter is the clear winner. It simply forces buildout to do the right thing now and forever, by limiting what packages it can select from. For those that want functionality and don’t mind the occasional egg-out-of-whack (i.e. unexpected upgrade), then using the find-links parameter can provide a “sexy” way to get decent results quickly (but may, and probably will, shoot you in the foot later).

对于那些需要严格的可重复性的人来说,使用index参数无疑是赢家。 通过限制它可以选择的软件包,它只是迫使构建现在和永远做正确的事情。 对于那些需要功能并且不介意偶尔出现问题的人(即意外升级),那么使用find-links参数可以提供一种“性感”的方法来快速获得不错的结果(但可能并且可能会在稍后射击您的脚)。

性感但危险 (Sexy, but Dangerous)

Let’s start with the sexy, but with less repeat-ability method first. Using this method we are not specifying our own index. Therefore you are free to add any package from PyPI or plone.org as you see fit. This is essentially why people like this method (the counter argument is that it is simple to add any additional egg you may want to your index, but we’ll get to that later).

让我们从性感开始,但首先要减少重复性方法。 使用这种方法,我们没有指定自己的索引。 因此,您可以根据需要随意从PyPIplone.org添加任何软件包。 基本上这就是人们喜欢这种方法的原因(counter参数是,将您可能想要的任何其他鸡蛋添加到索引很简单,但是稍后我们会介绍)。

So a simple buildout using this method might look like this:

因此,使用此方法的简单构建可能如下所示:

virtualenv plone; cd plone
bin/easy_install zc.buildout
bin/buildout init
Edit buildout.cfg:
virtualenv plone; cd plone
bin/easy_install zc.buildout
bin/buildout init
Edit buildout.cfg:

A few more steps are required, which we could certainly automate in buildout, but for now I’ll just list them here:

还需要执行一些步骤,我们当然可以在构建过程中使其自动化,但是现在我将在此处列出它们:

  1. bin/mkzopeinstance
  2. bin/addzope2user admin admin
  1. bin / mkzopeinstance
  2. bin / addzope2user admin管理员

Now, the moment we’ve all been waiting for… the fun part!

现在,我们一直在等待……有趣的部分!

  1. bin/paster serve etc/zope2.ini
  1. 箱/粘贴服务等/zope2.ini

You should see something like:

您应该看到类似以下内容:

[aclark@alex-clarks-macbook-pro]~/Developer/plone% bin/paster serve etc/zope2.ini
2009-06-18 22:52:24 INFO Marshall libxml2-python not available. Unable to register libxml2 based marshallers.
2009-06-18 22:52:27 WARNING ZODB.FileStorage Ignoring index for
/Users/aclark/Developer/p3-repoze-2/var/Data.fsDeprecationWarning: zope.app.annotation has moved to
zope.annotation. Import of zope.app.annotation will become
unsupported in Zope 3.5
/Users/aclark/Developer/plone/eggs/zopelib-2.10.7.0-py2.4-macosx-10.5-i386.egg/zope/configuration/xmlconfig.py:323:
  __import__(arguments[0])
------
2009-06-18T22:52:24 INFO Marshall libxml2-python not available. Unable to register libxml2 based marshallers.
------
2009-06-18T22:52:27 WARNING ZODB.FileStorage Ignoring index for /Users/aclark/Developer/plone/var/Data.fs
Starting server in PID 26900.
zserver on port 8080
[aclark@alex-clarks-macbook-pro]~/Developer/plone% bin/paster serve etc/zope2.ini
2009-06-18 22:52:24 INFO Marshall libxml2-python not available. Unable to register libxml2 based marshallers.
2009-06-18 22:52:27 WARNING ZODB.FileStorage Ignoring index for
/Users/aclark/Developer/p3-repoze-2/var/Data.fsDeprecationWarning: zope.app.annotation has moved to
zope.annotation. Import of zope.app.annotation will become
unsupported in Zope 3.5
/Users/aclark/Developer/plone/eggs/zopelib-2.10.7.0-py2.4-macosx-10.5-i386.egg/zope/configuration/xmlconfig.py:323:
  __import__(arguments[0])
------
2009-06-18T22:52:24 INFO Marshall libxml2-python not available. Unable to register libxml2 based marshallers.
------
2009-06-18T22:52:27 WARNING ZODB.FileStorage Ignoring index for /Users/aclark/Developer/plone/var/Data.fs
Starting server in PID 26900.
zserver on port 8080

At this point, you should be able to login to http://localhost:8080/manage and create a Plone site.

此时,您应该能够登录到http:// localhost:8080 / manage并创建一个Plone站点。

Of course, we did a sloppy job here, creating the Zope2 instance in the root of the buildout, etc. It is possible that plone.recipe.zope2install may help us in the future by supporting repoze.zope2 instances (or maybe it does already, I didn’t try).

当然,我们在这里做得很草率,在构建的根目录中创建了Zope2实例, 依此类推。plone.recipe.zope2install将来可能会通过支持repoze.zope2实例来帮助我们(或者也许已经做到了) ,我没有尝试)。

Next up?

接下来呢?

无聊但可重复 (Boring, but Repeatable)

I kid, but this is actually a very serious concern for many people, and rightfully so. The notion that your buildout will work the same today as it does in one year from now may be a strict requirement for your project. If it is, we can accommodate you (I hope) with the “index” buildout that follows. The downside is that *you* can’t control what I put in the index. However, you can certainly create your own index using this technique.

我开玩笑,但这实际上对许多人来说是一个非常严重的关切,理所当然的。 对于您的项目来说,构筑物在今天和一年后一样有效的想法可能是严格的要求。 如果是这样,我们(希望)可以为您提供下面的“索引”扩展。 缺点是*您*无法控制我输入的索引。 但是,您当然可以使用此技术创建自己的索引。

An arguably even simpler buildout using this technique might look like this:

使用这种技术可以说是一个甚至更简单的构建可能看起来像这样:

  1. virtualenv plone; cd plone
  2. bin/easy_install zc.buildout
  3. bin/buildout init
  4. Edit buildout.cfg:
  1. virtualenv plone; cd plone
  2. bin / easy_install zc.buildout
  3. bin / buildout初始化
  4. 编辑buildout.cfg:

结论 (In Conclusion)

Depending on what my needs are, I might choose either of these techniques. We can also hold out for multi-index support in setuptools. That would seemingly make everyone happy. In the meantime, I can tell you I’d definitely reach for a buildout sans custom index first, then ask questions later (i.e. wait for bleeding toes) but that is just me. If people find the “index” technique generally useful, I’d be willing to support package sheperding and index generating with basketweaver. Just let me know. If it really catches on, we could rename http://dist.plone.org/experimental/release/3.3rc3/ to http://dist.plone.org/repoze/release/3.3rc3/. Of course, if anyone objects to this or finds it confusing, I can just as easily remove it (from dist.plone.org).

根据我的需求,我可以选择其中一种技术。 我们也可以在setuptools中支持多索引 。 这似乎会让每个人都开心。 同时,我可以告诉您,我肯定会先达到无Sans自定义索引的构建,然后再问问题(即等待脚趾出血),但这仅是我自己。 如果人们发现“索引”技术通常很有用,我愿意支持使用basketweaver进行软件包打包和索引生成 。 请让我知道。 如果确实流行,我们可以将http://dist.plone.org/experimental/release/3.3rc3/重命名为http://dist.plone.org/repoze/release/3.3rc3/ 。 当然,如果有人反对或发现它令人困惑,我也可以轻松地将其删除(从dist.plone.org中删除)。

Special thanks to Chris McDonough and Martin Aspeli for helping me scratch my itch!

特别感谢Chris McDonoughMartin Aspeli帮助我Martin痒!

Finally, please don’t rely on any of this “in production” yet unless you know what you are doing. I tested these techniques up to the point of starting Zope (via paste) and adding a Plone site, nothing more!

最后,除非您知道自己在做什么,否则请不要依赖任何这种“生产中”的东西。 我测试了这些技术,直到启动Zope(通过粘贴)并添加一个Plone网站,仅此而已!

I, however, am getting a new server next week and will be hosting this site on repoze.zope2 very shortly 😉

但是,下周我将获得一台新服务器,并将很快在repoze.zope2上托管此网站😉

翻译自: https://www.pybloggers.com/2009/06/a-sane-buildout-for-repoze-zope2-plone/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值