Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

How to use Django with CUBRID


Overview

Django_cubrid is the official Django backend for CUBRID Database which is distributed together with the CUBRID Python driver (CUBRIDdb). When using Django web framework with CUBRID database, the django_cubrid backend should be used.

For more information about CUBRID Database, refer to Important Facts to Know about CUBRID.

Prerequisites

  1. Python 2.5 - 2.7
    Being a Python Web framework, Django requires Python version from 2.5 to 2.7 (due to backwards incompatibilities in Python 3.0, Django does not currently work with Python 3.0).
    So, when using django_cubrid, the Python version should also be from 2.5 to 2.7. 
  2. CUBRIDdb (the CUBRID Python driver)
    The django_cubrid backend will call the Python interface to access CUBRID DB. 
  3. Django Web Framework
    The django_cubrid backend requires Django 1.4 or 1.5 (tested with Django-1.4.2, 1.5).

Relevant links:

Build and Install

Since django_cubrid backend is distributed together with the CUBRID Python driver, all you need to do is install the CUBRID driver.

Configure django_cubrid

Configure the DATABASES part in your setting.py as shown below:

DATABASES = {
    'default': {
        'ENGINE': 'django_cubrid',       # The backend name: django_cubrid
        'NAME': 'demodb',                  # CUBRID database name: eg. demodb
        'USER': 'public',                      # a database user: eg. public
        'PASSWORD': '',                     # a database user password: eg. an empty password
        'HOST': '',                            # Set to empty string for localhost.
        'PORT': '33000',                 # Set to empty string for default 33000.
    }
}

Known issues

  • The Django sqlflush command may fail because of the foreign constraints between database tables.
  • After using the Django loaddata command, the insert SQL manipulation in the application may fail, becuse of the unique constraint violations.
  • You may also encounter the below warning:
    RuntimeWarning: DateTimeField received a naive datetime (2013-01-15 06:38:37.463000) while time zone support is active.
    The reason is that CUBRID doesn't support timezone. You can set "USE_TZ" to False in settings.py to avoid this warning.

License

CUBRID is distributed under two licenses:

  • The CUBRID Database Engine is distributed under GPL v2 or later.
  • The drivers including the django_cubrid backend are distributed under BSD license.

For more information about the licensing policy, visit http://www.cubrid.org/license.

comments powered by Disqus
Page info
viewed 1870 times
translations en
Author
posted last year by
beagem
Contributors
updated last year by
View revisions
tagged
Share this article