2010年5月15日土曜日

macでsphinxのインストール

mac os xでsphinxのインストールをしてみた。
僕がはまったのは次の二つ

"error: /usr/local/bin/sphinx-build: Permission denied"がでる
→sudoコマンドでeasy_installコマンドを実行する


"easy-install"といれてもコマンドがないと言われる
→ハイフンではなくてアンダースコア

上記を踏まえて、Let's try!


********-*****-no-macbook-pro:local *****$ sudo easy_install http://pypi.python.org/packages/2.6/S/Sphinx/Sphinx-0.6.5-py2.6.egg#md5=d1230f6d317a35770365f62225069259
Downloading http://pypi.python.org/packages/2.6/S/Sphinx/Sphinx-0.6.5-py2.6.egg#md5=d1230f6d317a35770365f62225069259
Processing Sphinx-0.6.5-py2.6.egg
removing '/Library/Python/2.6/site-packages/Sphinx-0.6.5-py2.6.egg' (and everything under it)
creating /Library/Python/2.6/site-packages/Sphinx-0.6.5-py2.6.egg
Extracting Sphinx-0.6.5-py2.6.egg to /Library/Python/2.6/site-packages
Sphinx 0.6.5 is already the active version in easy-install.pth
Installing sphinx-build script to /usr/local/bin
Installing sphinx-quickstart script to /usr/local/bin
Installing sphinx-autogen script to /usr/local/bin

Installed /Library/Python/2.6/site-packages/Sphinx-0.6.5-py2.6.egg
Processing dependencies for Sphinx==0.6.5
Searching for docutils>=0.4
Reading http://pypi.python.org/simple/docutils/
Reading http://docutils.sourceforge.net/
Best match: docutils 0.6
Downloading http://prdownloads.sourceforge.net/docutils/docutils-0.6.tar.gz?download
Processing docutils-0.6.tar.gz
Running docutils-0.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QL4h1w/docutils-0.6/egg-dist-tmp-AASUn6
zip_safe flag not set; analyzing archive contents...
docutils.parsers.rst.directives.misc: module references __file__
docutils.writers.html4css1.__init__: module references __file__
docutils.writers.latex2e.__init__: module references __file__
docutils.writers.newlatex2e.__init__: module references __file__
docutils.writers.odf_odt.__init__: module references __file__
docutils.writers.pep_html.__init__: module references __file__
docutils.writers.s5_html.__init__: module references __file__
Adding docutils 0.6 to easy-install.pth file
Installing rst2html.py script to /usr/local/bin
Installing rst2latex.py script to /usr/local/bin
Installing rst2man.py script to /usr/local/bin
Installing rst2newlatex.py script to /usr/local/bin
Installing rst2odt.py script to /usr/local/bin
Installing rst2odt_prepstyles.py script to /usr/local/bin
Installing rst2pseudoxml.py script to /usr/local/bin
Installing rst2s5.py script to /usr/local/bin
Installing rst2xml.py script to /usr/local/bin
Installing rstpep2html.py script to /usr/local/bin

Installed /Library/Python/2.6/site-packages/docutils-0.6-py2.6.egg
Searching for Jinja2>=2.1
Reading http://pypi.python.org/simple/Jinja2/
Reading http://jinja.pocoo.org/
Best match: Jinja2 2.4.1
Downloading http://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.4.1.tar.gz#md5=e0cf5af057fac63ac9689b86c8b31ce6
Processing Jinja2-2.4.1.tar.gz
Running Jinja2-2.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Itm1u1/Jinja2-2.4.1/egg-dist-tmp-b6WF5r
warning: no previously-included files matching '*' found under directory 'docs/_build/doctrees'
Adding Jinja2 2.4.1 to easy-install.pth file

Installed /Library/Python/2.6/site-packages/Jinja2-2.4.1-py2.6.egg
Searching for Pygments>=0.8
Reading http://pypi.python.org/simple/Pygments/
Reading http://pygments.org/
Reading http://pygments.pocoo.org/
Best match: Pygments 1.3.1
Downloading http://pypi.python.org/packages/2.6/P/Pygments/Pygments-1.3.1-py2.6.egg#md5=05270ee059c038407364b28993980960
Processing Pygments-1.3.1-py2.6.egg
creating /Library/Python/2.6/site-packages/Pygments-1.3.1-py2.6.egg
Extracting Pygments-1.3.1-py2.6.egg to /Library/Python/2.6/site-packages
Adding Pygments 1.3.1 to easy-install.pth file
Installing pygmentize script to /usr/local/bin

Installed /Library/Python/2.6/site-packages/Pygments-1.3.1-py2.6.egg
Finished processing dependencies for Sphinx==0.6.5
********-*****-no-macbook-pro:local *****$

上手くいったようだ。

2010年4月30日金曜日

引っ越ししました

レンタルしているケーブルテレビ会社のブログから、bloggerに引っ越しました。
苦労するかと思ったけれど、かなり簡単でした。

1. 元のblogの管理画面から、blogをMovable Type形式でエクスポートする。
2. エクスポートしたファイルを、http://movabletype2blogger.appspot.com/ で変換する。
3. 変換したファイルを、bloggerの管理画面でインポートする。

画像はさすがにアップロードされないので、何とかせねばならないけど何とかしなくてもいいかとも考えている。

2010年4月18日日曜日

Joomla1.5+さくらレンタルサーバでフレンドリーURL

Joomla 1.5を使うと、ディレクトリを分けて複数のサイトを管理する事ができる。また、"http://www.foo.bar.com/info"といったユーザーフレンドリーなURLを使う事ができる。これを組み合わせてさくらのレンタルサーバで使うにあたって少し苦労したので、ここに備忘録として記しておく。

・Joomlaの設定
http://foo.domainname.com/としたい場合は、インストール場所は、~/www/fooにする。http://www.domainname.com/としたい場合は、インストール場所は~/www/wwwにする。ただしwwwのみの単一運用であれば、~/wwwにする。
管理画面から、基本設定−サイトに移動する。
SEOの設定で「サーチエンジンフレンドリーURL=はい」「Apache mod_rewriteを利用=はい」「サフィックスをURLに追加=いいえ」二設定する。

・さくらのサーバ側の設定
もし、wwwで始まらないドメインを使いたい場合には、ドメイン設定でドメインを追加する。このドメインは標準のドメインではなく、別途取得したオリジナルドメインである必要がある。さらに、サブドメインの指定も行っておく。
Joomlaをインストールしたディレクトリに存在するhtaccess.txtを.htaccessに変更する
.htaccessの中身について「Options +FollowSymLinks」と「RewriteBase /」のコメントを削除する

2010年3月31日水曜日

web2py & GAEによるデモ on youtube2

前のブログの動画の続きです。
これらの動画は、Python & Ruby東海での発表内容を動画で再構築したものです。

2010年3月29日月曜日

web2py & GAEによるデモ on youtube

0からweb2pyを使ってGoogle App Engineのアプリを作る方法を作成しました。見てね。

2010年3月16日火曜日

40秒で作るweb2pyアプリ

■[Python]40秒で作るweb2pyアプリ
web2pyもRailsには負けていません。何せ後発ですから。
「何かメモするアプリ」ということで作ってみます。環境はこんな感じです。

$ python web2py
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.76.5 (2010-03-11 15:19:08)
Database drivers available: SQLite3
Starting hardcron...
というわけで、つくるよ!

アプリケーション作成
管理サイト上で、アプリケーションを作ります。


モデル生成

モデルはソースコード(db.py)で定義します。
db.define_table('note',
Field('body', 'text')
)

コントローラーの作成

データの入力と表示を行うコントローラーを作成します。
def index():
form = SQLFORM(db.note)
if form.accepts(request.vars):
redirect(URL(r=request))
notes = db().select(db.note.ALL)
return dict(form=form, notes=notes)

はい、これで完成。

ブラウザで確認
ブラウザで確認します。
http://localhost:8000/mynote/
出ました!



web2pyも簡単だよ。

2010年3月15日月曜日

WHR-G300Nで接続がよく切れる

バッファロー社のWHR-G300Nを使っていて接続がぶちぶち切れてしまう時は、無線設定のWPS機能をオフにすると調子が良くなるようです。危うく新しい無線ルーターを買ってしまうところだった。