Project Tin Canでは、サンプルのLRSのソースを以下のGithubリポジトリで公開しています。
https://github.com/adlnet/ADL_LRS
アプリケーションの実行までの手順も記載されています。
ドキュメントは、Ubuntuでのセットアップ手順として書かれているので、
Ubuntuユーザの方はそのままでいいと思いますが、
一応私がMacで作業した際の注意点を列挙したいと思います。
作業環境:
OS: Max OSX 10.8.4
- 必要なソフトウェアのインストール
sudo apt-get install git fabric postgresql-9.1 python-setuptools postgresql-server-dev-9.1 python-dev
sudo easy_install pip
sudo pip install virtualenv
Macではapt-getが使えないので、Homebrew やその他のパッケージ管理アプリケーションを利用して必要なソフトウェアを揃えましょう。
また、Homebrewを使ってpostgresqlをインストールした場合、postgresql-server-dev-9.1だけを新たに入れる必要は無いようでした。
参考:
- Postgresのセットアップ
sudo passwd postgres (set password for postgres system user)
sudo -u postgres createuser -P <db_owner> (create postgres user that will be owner of the db - make superuser)
su postgres
psql template1
- データベースの設定
CREATE DATABASE lrs OWNER <db_owner>;
\q (exits shell)
exit (logout as system postgres user)
- LRS用のユーザの作成
sudo useradd -c "ADL Learning Record Store System" -m -s "/bin/bash" adllrs
sudo passwd adllrs (set password)
su adllrs
cd ~
※開発環境がUbuntuの場合はそのままでいいですが、Macの場合は、dsclの-createサブコマンドを使用しましょう
- LRS用のディレクトリ作成
mkdir <dir_name>
cd <dir_name>
- LRSをGithubからコピー
git clone https://github.com/adlnet/ADL_LRS.git
cd ADL_LRS
※コピー後、ADL_LRS/adl_lrs/settings.pyの以下の項目を編集しましょう。
・データベース設定
・TimeZone設定='Asia/Tokyo'に変更
・LANGUAGE_CODE = 'ja'に変更
・SECRET_KEYも任意の文字列に変更しましょう。
- 実行環境のセッティング
fab setup_env
source ../env/bin/activate
- LRSのセットアップ
fab setup_lrs (when prompted make adllrs a Django superuser)
※setup_lrsの実行時に、
TypeError: with_metaclass() got an unexpected keyword argument 'base'
と出て処理が途中で止まってしまう場合、
ADL_LRSディレクトリから見て、
../env/lib/python2.7/site-packages/jsonfield/fields.py にあるコードの 50行目
class JSONFieldBase(six.with_metaclass(SubfieldBase, base=models.Field)):を
class JSONFieldBase(six.with_metaclass(SubfieldBase, models.Field)): に修正
再度 fab setup_lrsを実行後、
"You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): "
と聞かれるので yes を入力
"TypeError: decode() argument 1 must be string, not None"
とまたしてもエラーが出ますが、
再度 fab setup_lrsを実行すると、エラーなく処理が終わります。
- LRSの起動
ADL_LRSディレクトリにいる状態で、
supervisord
を実行後
supervisorctl
で、実際にシステムが起動しているか確認ができます。
画面に running の文字が出ていれば起動成功です。
適当なwebブラウザを起動し、http://localhost:8000/xapi/ とURL欄に撃ちこめばLRSにアクセスできます。
以上でLRS起動までの手順は終了です。
公開されているLRSは基本的な機能を持つだけなので、
今後、集められたデータをどう使うのか、
そういった+αの機能を持つLRSが出てきそうですね。