我正在使用 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 数据库上工作。