CentOS 5 に Plone 3.1 をインストールしたのでその手順

Python の有名な CMS である Plone を入れてみることにしました。現在の最新リリースは 3.1.7 のようです。 Plone 4 : パワフルで高速なCMS — Plone - エンタープライズ・オープンソースCMS Plone Users Group Japan に日本語の情報があります。 ダウンロード http://plone.org/products/plone の Get Plone for Linux/BSD/Unix (33MB) Unified Installer - for Linux/BSD/OS X/UNIX/Solaris (compiles and installs) を使います。 % wget http://launchpad.net/plone/3.1/3.1.7/+download/Plone-3.1.7ex-UnifiedInstaller.tgz % tar zxvf Plone-3.1.7ex-UnifiedInstaller.tgz % cd Plone-3.1.7ex-UnifiedInstaller インストール README.txt によると、install.sh をたたくだけでインストールできるようです。 Python は /usr のものを使いたいので –with-Python オプションで指定しました。–target でインストールディレクトリを指定します。デフォルトは /opt/Plone-3.1 になるみたいです。私は、/proj に何か試すときはいつも入れているので、そちらを指定しました。サービスユーザーとしてデフォルトで plone が追加されます。これはそのままにしました。 % sudo ./install.sh --target=/proj/Plone-3.1 --with-python=/usr/bin/python standalone Stand-Alone Zope Instance selected Detailed installation log being written to /home/tosshi/plone/Plone-3.1.7ex-UnifiedInstaller/install.log \\nTesting /usr/bin/python for Zope/Plone requirements.... Warning: the Python Imaging Library is missing. We'll try to build it, but watch for problems. /usr/bin/python looks OK. We'll try to use it. Root install method chosen Installing Plone 3.1.6 at /proj/Plone-3.1 Creating python virtual environment... New python executable in /proj/Plone-3.1/Python-2.4/bin/python Installing setuptools.............done. Skipping zlib compile and install Skipping libjpeg compile/install Skipping readline compile/install Python found at /proj/Plone-3.1/Python-2.4/bin/python; Skipping Python install. Installing PIL Installing Cheetah template engine Unpacking buildout cache to /proj/Plone-3.1/buildout-cache Compiling .py files in egg cache id: plone: そのようなユーザは存在しません Adding user account 'plone' to system ... Generating random password ... Copying standalone buildout template Running buildout Creating directory '/proj/Plone-3.1/zinstance/parts'. Creating directory '/proj/Plone-3.1/zinstance/develop-eggs'. Installing plone. Installing zope2. running build_ext creating zope.proxy copying zope/proxy/proxy.h -> zope.proxy building 'AccessControl.cAccessControl' extension creating build creating build/temp.linux-i686-2.4 creating build/temp.linux-i686-2.4/AccessControl (省略) running build_ext Installing productdistros. Installing instance. Generated script '/proj/Plone-3.1/zinstance/bin/instance'. Generated script '/proj/Plone-3.1/zinstance/bin/repozo'. Installing zopepy. Generated interpreter '/proj/Plone-3.1/zinstance/bin/zopepy'. Installing zopeskel. Generated script '/proj/Plone-3.1/zinstance/bin/paster'. Installing chown. chown: Running chmod 600 .installed.cfg find /proj/Plone-3.1/zinstance -type d -name var -exec chown -R plone \\{\\} \\; find /proj/Plone-3.1/zinstance -type d -name LC_MESSAGES -exec chown -R plone \\{\\} \\; find /proj/Plone-3.1/zinstance -name runzope -exec chown plone \\{\\} \\; Unused options for chown: 'update-command'. Installing unifiedinstaller. Generated script '/proj/Plone-3.1/zinstance/bin/plonectl'. Installing precompile. precompiling python scripts in /proj/Plone-3.1/zinstance/products precompiling python scripts in /proj/Plone-3.1/zinstance/parts/productdistros precompiling python scripts in /proj/Plone-3.1/zinstance/parts/plone Creating Plone site... This is the first start of this instance. Creating Data.fs and a Plone site. We only need to do this once, but it takes some time. Creating Plone site at /Plone in ZODB... Installed Plone standard content Finished adding Plone site ##################################################################### ###################### Installation Complete ###################### Plone successfully installed at /proj/Plone-3.1 See /proj/Plone-3.1/zinstance/README.txt for startup instructions Use the account information below to log into the Zope Management Interface The account has full 'Manager' privileges. Username: admin Password: xxxxxxxxx This account is created when the object database is initialized. If you change the password later, you'll need to use the new password. Ask for help on plone-users list or #plone Submit feedback and report errors at http://dev.plone.org/plone . For install problems, specify component "Installer (Unified)." 上記のとおり、Zope の初期アカウントの Username と Password が表示されます。/proj/Plone-3.1/zinstance/adminPassword.txt にあるのでメモし忘れても平気です。 /proj/Plone-3.1/zinstance/README.txt を見ろとある。 ...

2009年1月12日 · Toshimitsu Takahashi

Python 2.5 と Google App Engine を試してみる

先日、ある方から著者である柴田さんのサイン入りの「みんなのPython」をいただいた。 みんなのPython せっかく Python をやるなら Google App Engine だろうと思い、登録しようとしたら案の定 Waiting List 入り、早くサインアップだけしておくべきだった。 とりあえず SDK を落としてインストールしようとしたら Python 2.5 が必須とのこと。自分が普段使っている CentOS 5 に入ってるのは Python 2.4 なので、別途インストールしなければならない。 というわけでまずは環境構築からスタートのようです。 ちょっと脱線 Google Gear があって Google App Engine と来たので、なんかデータストアの部分をカプセルかして提供してくれるとかいう物とかあるのかと思ったんですが、そういうことはないようです。 なんか Google Gear で本来のサーバーサイド処理も JavaScript でみたいな実装ができて、それでオンラインもオフラインもどっちも意識せずに開発できるようなことにはならないのだろうか。 ECMAScript というか ActionScript 3 を見てると Java と変わらない厳格な書き方もできるし、Flex の実装してるともうサーバーサイドもこの言語で書ければいいのにと思う。 Python 2.5 と Google App Engine をセットアップ Download Python から Python 2.5.2 compressed source tarball のリンク URLを wget してコンパイルする。とりあえずオプションは特に付けなかった。 $ wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2 $ bunzip2 -c Python-2.5.2.tar.bz2 | tar xvf - $ cd Python-2.5.2 $ ./configure --prefix=/usr/local/Python-2.5.2 $ make $ sudo make install さらに Google App Engine を落として展開する。Downloads - Google App Engine — Google Developers から Linux/Other Platforms - 1.0.1 - 4/14/08 を入れる。 ...

2008年5月4日 · Toshimitsu Takahashi

アクセスログの URL エンコードされた部分を見るパイプ用スクリプトを Python で書く

decode.py を下記のように作る。 #!/usr/bin/env python import sys, urllib line = sys.stdin.readline() while line: print urllib.unquote_plus(line), line = sys.stdin.readline() ※ urllib.unquote だと + がスペースには置換されない。 $ tail -f /var/log/httpd/access_log | ./decode.py みたいに使う。ロケールが UTF-8 であることを前提にしてます。

2008年3月13日 · Toshimitsu Takahashi

Python のクラスについて

インスタンス生成時に new は不要。 メソッドの第一引数には self を指定する(this の役割)。 文字列をクラス内にベタに定義すると、オブジェクトの説明を示す __doc__ 属性(docstring)になる。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #!/usr/bin/python # class Hoge: "Hoge is Test class." age = 19 def name(self): return "Hoge!" print "hello world" hoge = Hoge() print hoge.name() print hoge.age print hoge.\_\_doc\_\_ hello world Hoge! 19 Hoge is Test class. 参考 http://www.python.jp/doc/2.4/tut/node11.html http://www.shido.info/py/python7.html 追記 インデントは 4 スペースが慣例。 del で変数などを削除できる。 Python が見えてきた・・・、やっぱり色んな言語を知ることは世界観が広がっていいです。

2007年8月7日 · Toshimitsu Takahashi