django oracle检查数据库失败
我正在使用 django 1.3。我有一个现有的 oracle 数据库(10g),我想使用inspectdb 构建模型。
'db': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'DBNAME',
'USER': 'me',
'PASSWORD': 'something',
}
所以当运行inspectdb时我得到:
$ python manage.py inspectdb --database db
cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle
所以我添加
$ export ORACLE_HOME=/usr/oracle/
$ TWO_TASK=DBNAME
我尝试使用相同的凭据使用sqlplus登录,一切看起来都很好。
所以......我再次运行inspectdb,但这一次我得到
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.
from django.db import models
(即它是空白的)
任何想法?我在 mysql 数据库上使用它没有任何问题。
i'm using django 1.3. i have an existing oracle database (10g) i would like to build Model's from using inspectdb.
'db': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'DBNAME',
'USER': 'me',
'PASSWORD': 'something',
}
so when run inspectdb i get:
$ python manage.py inspectdb --database db
cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle
so i add
$ export ORACLE_HOME=/usr/oracle/
$ TWO_TASK=DBNAME
i try logging on with sqlplus with the same credentials and everything looks good.
so... i run inspectdb again, but this time i get
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.
from django.db import models
(ie it's blank)
any ideas? i had no problems getting this to work on a mysql database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自官方文档。
如果您想提交它,目前 Django 跟踪器中没有列出该错误。
From the official docs.
There is currently not a bug listed for it in the Django tracker if you wanted to submit it.
我的 settings.py 顶部有一个类似的设置,用于为我的 Oracle 驱动程序 (Oracle 11.2) 设置环境变量。不确定这对您的具体情况是否有帮助。
我在 Oracle 11.2 上使用
manage.pyspectdb
(Django 1.2.7 和 Django 1.4)没有任何问题。I have a similar setup at the top of my settings.py to set my environment variables for my oracle driver (Oracle 11.2). Not sure if this will help in your specific case.
I have had no issues with
manage.py inspectdb
(Django 1.2.7 and Django 1.4) on Oracle 11.2.