lektor - Python製の静的サイトジェネレータ
最近は静的なWebサイトジェネレータが人気です。わざわざデータベースを用意するのが面倒だったり、静的なサイトであればAmazon S3や簡単なWebサーバ上にデプロイするのも簡単です。 今回はそのためのソフトウェアlektorを紹介します。Pythonで作られた静的サイトジェネレータです。
lektorの使い方
lektorのコマンドヘルプです。基本はdevserverでサイトを確認しながら使います。
$ ../lektor.pex
Usage: lektor.pex [OPTIONS] COMMAND [ARGS]...
The lektor management application.
This command can invoke lektor locally and serve up the website. It's
intended for local development of websites.
Options:
--tree PATH The path to the lektor tree to work with.
--help Show this message and exit.
Commands:
build Builds the entire site out.
clean Cleans the entire build folder.
deploy Deploy the website.
devserver Launch a local development server.
Webサイトを見るとこのようになっています。
そして実際のコンテンツ。
モデルやコンテンツ、テンプレートなどがあり意外と本格的な気がします。
そしてデプロイは設定ファイルに依ります。
[site]
name = My Website
[servers.production]
enabled = yes
name = Production
target = rsync://myserver.com/path/to/website
見ての通り、この場合はRsyncを使っています。簡単に使えますね。サイトをローカルでさくさくと作り、後はdeployサブコマンドで外部サーバに配備するだけの簡単な静的サイト管理となっています。
lektorはPython製のオープンソース・ソフトウェア(BSD License)です。