Ubuntu8.04 で Django1.2.1 を使う為に色々と(1)

Ubuntuのバージョン確認

$ cat /etc/lsb-release
DISTRIB_RELEASE=8.04

PIL用ライブラリzlib/zlib-develのインストール

//yumコマンドを実行すると以下のエラーが発生
$ yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named cElementTree

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)]

If you cannot solve this problem yourself, please send this
message to <yum@lists.linux.duke.edu>.

//エラーメッセージに従いcElementTreeをインストール
$ cd ~/download wget http://effbot.org/media/downloads/cElementTree-1.0.5-20051216.tar.gz
$ tar zxvf cElementTree-1.0.5-20051216.tar.gz
$ cd cElementTree-1.0.5-20051216
$ sudo python setup.py install

//zlibをインストールすると警告が…
# yum install zlib
Warning, could not load sqlite, falling back to pickle
Setting up Install Process
Setting up repositories
No Repositories Available to Set Up
Reading repository metadata in from local files
Parsing package install arguments
No Match for argument: zlib
Nothing to do

以下のサイトを参考にし、pysqliteが入っていないのが問題かと仮説を立てる

pysqliteのインストール

$ wget http://pysqlite.googlecode.com/files/pysqlite-2.6.0.tar.gz
$ tar zxvf pysqlite-2.6.0.tar.gz
$ cd pysqlite-2.6.0
# vi setup.cfg
以下の様に修正
include_dirs=/usr/include
library_dirs=/usr/lib
# python setup.py build

//エラー発生
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -DSQLITE_OMIT_LOAD_EXTENSION=1 -I/usr/include -I/usr/include/python2.5 -c src/module.c -o build/temp.linux-i686-2.5/src/module.o
In file included from src/module.c:24:
src/connection.h:33:21: error: sqlite3.h: No such file or directory
In file included from src/module.c:24:
src/connection.h:38: error: expected specifier-qualifier-list before 'sqlite3'
In file included from src/module.c:25:
src/statement.h:37: error: expected specifier-qualifier-list before 'sqlite3'
src/module.c: In function 'module_complete':
src/module.c:99: warning: implicit declaration of function 'sqlite3_complete'
src/module.c: At top level:
src/module.c:265: error: 'SQLITE_OK' undeclared here (not in a function)
src/module.c:266: error: 'SQLITE_DENY' undeclared here (not in a function)
src/module.c:267: error: 'SQLITE_IGNORE' undeclared here (not in a function)
src/module.c:268: error: 'SQLITE_CREATE_INDEX' undeclared here (not in a function)
src/module.c:269: error: 'SQLITE_CREATE_TABLE' undeclared here (not in a function)
src/module.c:270: error: 'SQLITE_CREATE_TEMP_INDEX' undeclared here (not in a function)
src/module.c:271: error: 'SQLITE_CREATE_TEMP_TABLE' undeclared here (not in a function)
src/module.c:272: error: 'SQLITE_CREATE_TEMP_TRIGGER' undeclared here (not in a function)
src/module.c:273: error: 'SQLITE_CREATE_TEMP_VIEW' undeclared here (not in a function)
src/module.c:274: error: 'SQLITE_CREATE_TRIGGER' undeclared here (not in a function)
src/module.c:275: error: 'SQLITE_CREATE_VIEW' undeclared here (not in a function)
src/module.c:276: error: 'SQLITE_DELETE' undeclared here (not in a function)
src/module.c:277: error: 'SQLITE_DROP_INDEX' undeclared here (not in a function)
src/module.c:278: error: 'SQLITE_DROP_TABLE' undeclared here (not in a function)
src/module.c:279: error: 'SQLITE_DROP_TEMP_INDEX' undeclared here (not in a function)
src/module.c:280: error: 'SQLITE_DROP_TEMP_TABLE' undeclared here (not in a function)
src/module.c:281: error: 'SQLITE_DROP_TEMP_TRIGGER' undeclared here (not in a function)
src/module.c:282: error: 'SQLITE_DROP_TEMP_VIEW' undeclared here (not in a function)
src/module.c:283: error: 'SQLITE_DROP_TRIGGER' undeclared here (not in a function)
src/module.c:284: error: 'SQLITE_DROP_VIEW' undeclared here (not in a function)
src/module.c:285: error: 'SQLITE_INSERT' undeclared here (not in a function)
src/module.c:286: error: 'SQLITE_PRAGMA' undeclared here (not in a function)
src/module.c:287: error: 'SQLITE_READ' undeclared here (not in a function)
src/module.c:288: error: 'SQLITE_SELECT' undeclared here (not in a function)
src/module.c:289: error: 'SQLITE_TRANSACTION' undeclared here (not in a function)
src/module.c:290: error: 'SQLITE_UPDATE' undeclared here (not in a function)
src/module.c:291: error: 'SQLITE_ATTACH' undeclared here (not in a function)
src/module.c:292: error: 'SQLITE_DETACH' undeclared here (not in a function)
src/module.c: In function 'init_sqlite':
src/module.c:419: warning: implicit declaration of function 'sqlite3_libversion'
src/module.c:419: warning: passing argument 1 of 'PyString_FromString' makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1

sqlite3がpython2.5と同一path上にインストールされている必要があるとの事
はまったところ/pysqliteのインストール

sqlite3の再インストール

//インストールディレクトリの確認
# find / -name "sqlite"
/usr/bin/sqlite3

//アンインストール
# rm -rf sqlite*

//sqlite3のインストール
$ wget http://www.sqlite.org/sqlite-3.5.9.tar.gz
$ tar xvzf sqlite-3.5.9.tar.gz
$ cd sqlite-3.5.9
# ./configure --prefix=/usr/lib     """pythonの入ったディレクトリを指定"""
# make
# make install
# make clean

//インストール確認
$ which sqlite
$ which sqlite3

//入っていない…?
# find / -regex "*sqlite*"

//apt-getでインストール
# apt-get install sqlite3
Reading package lists... Done
Building dependency tree
Reading state information... Done
sqlite3 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.

//バージョン管理がおかしくなったか?
// Synapticを起動してみると次のエラーが表示される
W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/main Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_main_binary-i386_Packages)

W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/universe Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_universe_binary-i386_Packages)

//アンインストール
# apt-get remove sqlite3
Removing sqlite3 ...
W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/main Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_main_binary-i386_Packages)
W: Duplicate sources.list entry http://security.ubuntu.com hardy-security/universe Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_hardy-security_universe_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems
# apt-get update

//インストール
# apt-get install sqlite3
$ sqlite3
SQLite version 3.4.2
Enter ".help" for instructions
sqlite>
// ようやく元に戻った…が

libsqlite3-devが必要だったのか
http://www.linuxquestions.org/questions/linux-software-2/error-sqlite3-h-no-such-file-or-directory-771732/

pysqliteを今一度インストール

//libsqlite3-devのインストール
# apt-get install libsqlite3-dev
$ cd pysqlite-2.6.0
# vi setup.cfg
以下の様に修正
include_dirs=/usr/include
library_dirs=/usr/lib
# python setup.py build
# python setup.py install

//インストール確認
# python
>>> import sys
>>> sys.path.append('/usr/lib/python2.5/site-packages/')
>>> import pysqlite2
//エラーが出なければOK

JavaScriptライブラリjQueryの使用

//ダウンロード
$ wget http://code.jquery.com/jquery-1.4.2.min.js
//Djangoプロジェクト直下に配置
$ mv jquery-1.4.2.min.js ~/path/to/project/templates/static/js/

//JGrowlプラグインも利用
$ wget http://plugins.jquery.com/files/jGrowl-1.2.4.zip
$ unzip jGrowl-1.2.4.zip
$ mv jquery.jgrowl.css ~/path/to/project/templates/static/styles/
$ mv jquery.jgrowl.js ~/w*/manoush/templates/static/js/