引用
Django supports Oracle Database Server versions 9i and higher. Oracle version 10g or later is required to use Django's regex and iregex query operators. You will also need the cx_Oracle driver, version 4.3.1 or newer.
gentoo portage中没有cx_Oracle,所有要自己创建cxoracle.ebuild
创建ebuild具体方法-A2
ebuild cxoracle-4.3.1.ebuild digest
echo "dev-python/cxoracle ~x86" >> /etc/portage/package.keywords
emerge -av cxoracle
../settings.py
DATABASE_ENGINE = 'oracle'
DATABASE_NAME = 'orcl'
DATABASE_USER = 'username'
DATABASE_PASSWORD = 'password'
DATABASE_HOST = 'hostname'
DATABASE_PORT = '1521'
如有以下error出现,请安装最新版的cx_Oracle
$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "//usr/lib/python2.5/site-packages/django/core/management
/__init__.py", line 340, in execute_manager
utility.execute()
...
File "//usr/lib/python2.5/site-packages/django/db/backends/
oracle/introspection.py", line 13, in DatabaseIntrospection
cx_Oracle.NCLOB: 'TextField',
AttributeError: 'module' object has no attribute 'NCLOB'
参考资料:
A1.
docs.djangoproject.com
A2. 由于http://zh.gentoo-wiki.com 暂时不能访问,先参考这个:
HOWTO Write Ebuilds
A3.
linux 环境下连接Oracle
附件: cxoracle-4.3.1.ebulid