tima620のゆらぎ

「のlog.txt」を畳み、「の」が崩御し、「のはざま」をはさんだ後に生まれた「のゆらぎ」

Pelicanのインストール・動作確認メモ

静的サイトジェネレータを触ってみようか。
http://docs.getpelican.com/en/3.3.0/

ちょいちょいここ見ながら。Getting started
http://docs.getpelican.com/en/3.3.0/getting_started.html

本家以外ではこの辺参考にしましたー。
http://qiita.com/5t111111/items/c5d261941f4d8440288e
http://blog.sotm.jp/2014/01/04/Pelican-Markdown-GithubPages-install-guide/

まずはPythonを手に入れよう

Rubyはおるんだけど、Pythonはおらんのよね。というわけで入れよう。

https://www.python.org/ のDownloadsから、Download for WindowsPython 3.4.1 選ぶ

ねくねくねく…フィニッシュ!

よし、見てみよう。

tima>python --version
Python 2.7.5

tima>

…あれ? 2.7.5だ。
Next押すとき見過ごしたのかもだけど、ディレクトリ見る限り2.7系と3.4系が入ったっぽい?
よくわからんけどこの辺は切り替えられるようにしたいね。そのあたりは後述のvirtualenvとかでうまくできそう。

ちなみにGetting started見るに

Pelican currently runs best on Python 2.7.x; earlier versions of Python are not supported. There is provisional support for Python 3.3, although there may be rough edges, particularly with regards to optional 3rd-party components.

だそうです。
基本的には2.7系で作業するのが無難みたいですね。

pipをゲット

pipはPythonのパッケージ管理システム。
コイツでPelican入れたりするわけですね。

Getting startedのリンクから https://pip.pypa.io/en/latest/

InstallationのInstall pipから、get-pip.pyをゲット。

tima>python get-pip.py
なんたらかんたら

tima>

こっから先ログ取り忘れはなんたらかんたらしてます

入ったかな。あと環境変数PathにC:\Python27; C:\Python27\Scripts;的なのを足しときましょう。と再起動。

virtualenvのインストール・試用

コイツはなに?って思ったけど、ここら辺見て何となく理解しましたー。
http://blog1.erp2py.com/2011/07/virtualenv.html

入れるよー

tima>pip install virtualenv
なんたらかんたら

tima>

さっくり入りましたねー。じゃあ仮想環境作ってみましょう! Getting startedに書いてある推奨のヤツでいこうかね!

tima>virtualenv ~/virtualenvs/pelican
New python executable in ~/virtualenvs/pelican\Scripts\python.exe
Installing setuptools, pip...done.

tima>

ほいほい。どうなってるかなー?

f:id:tima620:20140603010025p:plain

…それは違うよね?

tima>virtualenv virtualenvs\pelican
New python executable in .\virtualenvs\pelican\Scripts\python.exe
Installing setuptools, pip...done.

tima>

これでいきましょう。
次に実際に仮想環境のアクティベートを試したいね。
Getting startedのヤツでは. bin/activateってなってるけどうまくいかないので、適当に

tima>cd virtualenvs\pelican
tima>Scripts\activate
(pelican) tima>

お、仮想環境の表示になりましたね。仮想環境の停止はー

(pelican) tima>Scripts\deactivate.bat
tima>

できますねー。

Pelican, Git, Markdownをインストールする

Getting startedまんまです。いよいよ入れるよ! 

(pelican) tima>pip install pelican
ながながしいログ

(pelican) tima>pip install -e git+https://github.com/getpelican/pelican.git#egg=pelican
ながながしいログ

(pelican) tima>pip install Markdown
ながながしいログ

(pelican) tima>

pelican-quickstart!

基本的な使い方とかいろいろすっ飛ばして、クイックスタートしてみよう!
実は最近bitbucketを始めてみたので、そこのページにでも使ってみようかな。
このクイックスタートさんは質問形式でプロジェクト作りしてくれるんだけど、何を尋ねているかはこの記事の一番最初らへんの本家以外のサイトを見るといいかも。

(pelican) tima>pelican-quickstart
Welcome to pelican-quickstart v3.3.1.dev.

This script will help you create a new Pelican-based website.

Please answer the following questions so this script can generate the files
needed by Pelican.


> Where do you want to create your new web site? [.] bitbucketpage
> What will be the title of this web site? tima620
> Who will be the author of this web site? tima
> What will be the default language of this web site? [en] ja
> Do you want to specify a URL prefix? e.g., http://example.com   (Y/n) Y
> What is your URL prefix? (see above example; no trailing slash) http://tima620.bitbucket.org
> Do you want to enable article pagination? (Y/n) Y
> How many articles per page do you want? [10] 10
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) Y
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) Y
> Do you want to upload your website using FTP? (y/N) N
> Do you want to upload your website using SSH? (y/N) N
> Do you want to upload your website using Dropbox? (y/N) N
> Do you want to upload your website using S3? (y/N) N
> Do you want to upload your website using Rackspace Cloud Files? (y/N) N
> Do you want to upload your website using GitHub Pages? (y/N) N
Done. Your new project is available at どこそこ\virtualenvs\pelican\bitbucketpage

GitHub Pagesだって…?Oh…
プロジェクトできたって。素晴らしいね。
記事を書いてみよう。reなんちゃらはよくわからんのでMarkdownで書くよ。ごめんね。

f:id:tima620:20140603025754p:plain

(pelican) tima>cd bitbucketpage
(pelican) tima>make html
pelican どこそこ/virtualenvs/pelican/bitbucketpage/content -o どこそこ/virtualenvs/pelican/bitbucketpage/output -s どこそこ/virtualenvs/pelican/bitbucketpage/pelicanconf.py
WARNING: Feeds generated without SITEURL set properly may not be valid
Done: Processed 1 article(s), 0 draft(s) and 0 page(s) in 0.35 seconds.

あれ?サイトURLは設定したはずなんだけど?
bibucketpage内のpelicanconf.pyを見てみる。あれないぞ。加える。

(pelican) tima>make html
pelican どこそこ/virtualenvs/pelican/bitbucketpage/content -o どこそこ/virtualenvs/pelican/bitbucketpage/output -s どこそこ/virtualenvs/pelican/bitbucketpage/pelicanconf.py
Done: Processed 1 article(s), 0 draft(s) and 0 page(s) in 0.32 seconds.

おおうまくいった。outputディレクトリ内に丸ごとサイトが出来てるね。 bitbucketにpushしよう。

f:id:tima620:20140603030319p:plain

てってれー

そういえばココのブログとそっちのブログでふたつできちゃったけどどうすんの

あー、あー!とりあえず触っとけってヤツですかねー!

いやきっといいところあるじゃないですかPelicanよくわかってないですけど

あれですね、ぶっちゃけ何も考えてないやつですねー!でも機会があれば利点とかまとめたいですね自分のために