SQLite 3 Django Centos5 Howto..


artikel ini bermula dari keanehan yang terjadi setelah saya meng-update paket-paket debian saya. ketika sedang asik coding django dan ingin berpindah menggunakan database sqlite3, si django menolak untuk sinkronisasi dengan database baru, sqlite3.

katanya sqlite3 tidak masuk dalam module yang dikenali, saya cek paketnya, sqlite3 sudah terdaftar di modul python. ada yang aneh. karena sudah bosan dengan debian sebagai desktop, dan ingin mencoba suasana baru, maka saya putuskan install CentOS 5.1. setelah install, langsung saja, install paket django. selidik punya selidik, django belum di-integrasi di CentOS. ya sudah, nasib. install via Subversion saja.

tahap install django:

  1. $ yum install subversion
  2. $ mkdir django-src
  3. $ cd django-src
  4. $ svn co http://code.djangoproject.com/svn/django/trunk/
  5. $ cd trunk
  6. $ python setup.py install

selanjutnya install sqlite3

  1. $ wget -c http://sqlite.org/sqlite-amalgamation-3.6.4.tar.gz
  2. $ ./configure ; sudo make ; sudo make install
  3. $ wget -c http://dag.wieers.com/rpm/packages/python-sqlite2/python-sqlite2-2.3.3-1.el5.rf.i386.rpm
  4. $ sudo rpm -ivh python-sqlite2-2.3.3-1.el5.rf.i386.rpm

Saatnya test dengan django

  1. $ django-admin.py startproject cocoa
  2. $ cd cocoa ; vim settings.py
  3. use sqlite3 as your database and use full path to your database name, assuming your configuration like this, and be sure to suit your needs

DATABASE NAME=”/home/steve/cocoa/dbcocoa.db”

Okay, lets game or wish, use any unused port, if you like:

  1. $ python manage.py runserver 0.0.0.0:9000
  2. open your browser and pointing to http://localhost:9000, you should see django “it works” statement, then your django app now run on sqlite.
  3. stop it press (Ctrl + C), we need to customise the admin panel.
  4. before customise any things in admin panel, we should synchronise our database and make tables to admin panel. don’t worry, this is an automated task.
  5. $ python manage.py syncdb
  6. follow those steps
  7. $ vim urls.py
  8. uncomment line that contains “r’^admin/(.*)’, admin.site.root),
  9. $ vim settings.py
  10. find INSTALLED_APPS and put this line in it: ‘django.contrib.admin’,
  11. run your django web server once again
  12. $ python manage.py runserver 0.0.0.0:9000
  13. point your web browser address to http://localhost:9000/admin

2 thoughts on “SQLite 3 Django Centos5 Howto..

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s