无法将django1.11与oracle11g连接

时间:2019-07-11 09:45:29

标签: django oracle oracle11g

我无法在Linux中迁移项目。依赖:cx-Oracle == 7.2.0 Django == 1.11,oracle11g和python3。我正在尝试连接服务器数据库。

我从 /work/sunlife_env/lib/python3.6/site-packages/django/db/backends/oracle/base.py 中删除了一行self.cursor.numbersAsStrings = True,以解决此错误:

  

AttributeError:'cx_Oracle.Cursor'对象没有属性'numbersAsStrings'

但是,现在,在python manage.py迁移之后,我遇到了以下错误。

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 250, in apply_migration
    self.recorder.record_applied(migration.app_label, migration.name)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 73, in record_applied
    self.migration_qs.create(app=app, name=name)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/query.py", line 393, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/base.py", line 806, in save
    force_update=force_update, update_fields=update_fields)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/base.py", line 836, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/base.py", line 922, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/base.py", line 961, in _do_insert
    using=using, raw=raw)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/query.py", line 1060, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1106, in execute_sql
    return self.connection.ops.fetch_returned_insert_id(cursor)
  File "/home/arima/work/sunlife_env/lib/python3.6/site-packages/django/db/backends/oracle/operations.py", line 245, in fetch_returned_insert_id
    return int(cursor._insert_id_var.getvalue())
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'

我需要帮助将我的数据库连接到django项目。

0 个答案:

没有答案