おいも貴婦人ブログ

生物系博士課程満期退学をしたAIエンジニアのブログ。

研究の進捗もwebで管理しよう。(Django-helpdesk)

Welcome to django-helpdesk’s documentation! — django-helpdesk 0.1 documentation

てことで、研究の進捗を管理しましょう。よくあるチケット管理システムは主にバグ管理システムも付いていてなんだかややこしそう。単純にちょっと高機能なTODOを使いたならこれで十分だとおもいます。(この文章を書いている時点で、まだインストールすらしていない...。)基本的に研究に関することは、ローカルからのみアクセス出来ればいいので今回もVagrant+Djangoの組み合わせで実装していきたいと思います。Vagrant(CentOS6.4)の立ち上げは省略します。バグ管理システムは、追々実装する予定。

いつものやつー。(Chefを勉強したんだから、スクリプト化しておけば良かった...。)
yum update -y
yum install -y python-setuptools emacs python-devel
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
easy_install pip
pip install virtualenvwrapper

パイソーン

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar zxvf Python-2.7.9.tgz
cd Python-2.7.9
./configure
make
make install

.bashrcに追記

if [ -f /usr/bin/virtualenvwrapper.sh ]; then
    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/bin/virtualenvwrapper.sh
fi

うんでもって、読み込み

source ~/.bashrc

pythonの仮想環境の立ち上げ

mkvirtualenv --python=/usr/local/bin/python2.7 todo
nginxのインストールと起動
yum -y install epel-release
yum -y install nginx
service nginx start

無駄なiptabelsを切る。

iptables -F
service iptables stop
chkconfig iptables off
django-helpdeskのインストールと起動

パッケージのインストール

pip install django-helpdesk

プロジェクトの立ち上げ

django-admin.py startproject todo
cd todo
mkdir static db

settings.pyの設定。以下を追記(ログインに関して後日追加する予定。)

SITE_ID=1

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.humanize',  # Required for elapsed time formatting
    'helpdesk',  # This is us!   
    'south',                                                                                                                                              
    'markdown_deux',  # Required for Knowledgebase item formatting                                                                                                                                                  
    'bootstrapform', # Required for nicer formatting of forms with the default templates                                                                                                                            
                                                                                                                                                                                          
)
STATIC_ROOT = os.path.join('/home/vagrant/todo', 'static')
LOGIN_URL = '/helpdesk/login/'

変更点

    'NAME': os.path.join(BASE_DIR, 'db/db.sqlite3'),

データベースの作成と静的ファイルの収集

./mange.py syndb
./mange.py migrate
./manage.py collectstatic

urls.pyの書き換え

     url(r'helpdesk/', include('helpdesk.urls')),
     url(r'', include('helpdesk.urls')),

試しに起動させてみる。

 ./manage.py runserver 0.0.0.0:8080

ブラウザに"IP:8080"を打ち込んでhelpdeskが起動していればOK.