Gentoo中,使用Django 连接 Oracle

[quote]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.[/quote]

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 <module>
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. [url=http://docs.djangoproject.com/en/dev/ref/databases/?from=olddocs#id9]docs.djangoproject.com[/url]
A2. 由于http://zh.gentoo-wiki.com 暂时不能访问,先参考这个:[url=http://blog.chinaunix.net/u2/63996/showart_725950.html]HOWTO Write Ebuilds[/url]
A3. [url=http://marlgl.iteye.com/admin/blogs/255581]linux 环境下连接Oracle[/url]
附件: cxoracle-4.3.1.ebulid
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值