Latest Tweets:

deliverance を Mac上のvirtualenvにセットアップする

2009/8/8 @zope/plone開発勉強会

本日のテーマ
Today’s my goal is to make a local deliverance site work
本日のゴールはdeliverance サイトをローカルで動かすことです

やること

0.どうすれば動くのかを調べる

寺田さんのブログ
timさんのスライド

1.セットアップ

●ローカル環境にdeliveranceが動く環境を作る

構成がよくわからんなあ

deliveranceがapplicationサーバーだとすると、apacheとかいないとダメじゃない?

寺田さんの例だと Ploneと組み合わせてインストールするようになってるけど…

清水川さんに聞いてみた

deliverance 単体をインストールする

delveranceのプロセスを立ち上げるとproxyとして動くはず

defaultだとport 5000でリクエストを受けつけてport 8000にコンテンツを取りに行く(らしい)

http://deliverance.openplans.org/quickstart.html

これを見ながらやることにする

virtualenvスクリプトをダウンロードして、適当なところにおいて、実行

$python virtualenv.py —no-site-packages DelivTest

作成したvirtualenvディレクトリに移動

・ちなみに virtualenv ディレクトリに行って source bin/activate とやっておくと python, easyinstall などのデフォルトパスが virtualenvディレクトリになるので便利

$cd DelivTest

pipをインストール

$ ./bin/easy_install pip

インストールしたpipを使ってdeliverance の最新ビルドをインストール

$ ./bin/pip install http://deliverance.openplans.org/dist/Deliverance-snapshot-latest.pybundle

lxmlのインストールで makeでreturn code 2で落ちる

http://www.gawel.org/weblog/en/2008/12/combine-zc.buildout-an-pip-benefits によれば

For example to install lxml in a pure sandbox without libxml2 and libxslt installed you need Cython installed

$ ./bin/pip install Cython

Successfully installed Cython

もっぺんやる

$ ./bin/pip install http://deliverance.openplans.org/dist/Deliverance-snapshot-latest.pybundle

Command python setup.py egg_info failed with error code 1

ダメだ

http://www.gawel.org/weblog/en/2008/12/combine-zc.buildout-an-pip-benefits

にbuildoutで入れる例が出てるので、buildoutでやる

・まずbuildout入れる

$ easy_install zc.buildout

・buildoutを使えるようにしないと

$ makedir download

$ ./bin/buildout -init

・virtualenvにbuildout.cfgを作って上記サイトからコピペ。

$ ./bin/buildout
えらい時間かかるな。結局またpipだもんな。でも lxmlははいったっぽい

なんとか通ったっぽい。

なにやらconfigを paster でやるみたい

$ ./bin/paster create -t deliverance DelivTest

Selected and implied templates:

deliverance#deliverance  Basic template for a deliverance-proxy setup

Variables:

egg:      DelivTest

package:  delivtest

project:  DelivTest

Enter host (The host/port to serve on) [‘localhost:8000’]:

Enter proxy_url (The main site to connect/proxy to) [‘http://localhost:8080’]: http://zenich.com/mt

Enter proxy_rewrite_links (Rewrite links from sub_host?) [‘n’]: Y

Enter password (The password for the deliverance admin console) [”]: *****

Enter theme_url (A URL to pull the initial theme from (optional)) [”]:

—-

SystemError: Parent module ‘/Users/zenichiroyasuda/DelivTest/src/deliverance/deliverance/paster-templates/deliverance/etc/deliv-users’ not loaded at line 4 column 3 in file /Users/zenichiroyasuda/DelivTest/src/deliverance/deliverance/paster-templates/deliverance/etc/deliv-users.htpasswd_tmpl

ダメじゃん….

ということで手動でやる。

cd ~/DelivTest/src/deliverance

$ python setup.py develop

(なぜか1回目はコケて2回目は通った。)

/DelivTest/src/deliverance/deliverance/paster-templates/deliverance.xml_tmpl

を元にして rule xmlを作る

—-

<server-settings>

<server>localhost:8000</server>

<dev-user username=”admin” password=”******” />

</server-settings>

<proxy path=”/_theme”>

<dest href=”{here}/theme” />

</proxy>

<proxy path=”/”>

<dest href=”http://zenich.com/mt” />

</proxy>

—-

これだけ直して /DelivTest/deliverance.xml として保存

$ ./bin/deliverance-proxy ./deliverance.xml

To see logging, visit http://localhost:8000/.deliverance/login

serving on http://127.0.0.1:8000

動いたー

http://localhost:8000/?deliv_log

で変換状況のログが出る。