python manage.py migrate出现ORA-00955

m0_38087678 2019-04-19 05:40:00
麻烦大家帮我看下如下错误,感谢各位朋友:
我的环境是:

python环境是:Python 3.6.0

数据库已经连上了,我oralce中已经查到有这个链接了,执行python manage.py makemigrations是成功的,并且已经生成了信息,如下:

但是在python manage.py migrate时候就会报以下错误:
注:红色是由于我已经执行过了makemigrations后了,请关注非红色部分
PS E:\python_xx\product_project2> python .\manage.py makemigrations
Migrations for 'prod_text':
prod_text\migrations\0001_initial.py
- Create model BookInfo
- Create model HeroInfo


PS E:\python_xx\product_project2> python .\manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, prod_text, sessions
Running migrations:
Applying contenttypes.0001_initial...Traceback (most recent call last):
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\oracle\base.py", line 497, in execute
return self.cursor.execute(query, self._param_generator(params))
cx_Oracle.DatabaseError: ORA-00955: name is already used by an existing object

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File ".\manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\commands\migrate.py", line 204, in handle
fake_initial=fake_initial,
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\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 "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\operations\models.py", line 97, in database_forwards
schema_editor.create_model(model)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\base\schema.py", line 319, in create_model
self.execute(sql, params or None)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\base\schema.py", line 136, in execute
cursor.execute(sql, params)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\utils\six.py", line 685,in reraise
raise value.with_traceback(tb)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\oracle\base.py", line 497, in execute
return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: ORA-00955: name is already used by an existing object
...全文
131 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
m0_38087678 2019-04-19
  • 打赏
  • 举报
回复
这是重新删除migrations目录后重新执行的结果: E:\python_xx\product_project2>python manage.py makemigrations Migrations for 'prod_text': prod_text\migrations\0001_initial.py - Create model BookInfo - Create model HeroInfo E:\python_xx\product_project2>python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, prod_text, sessions Running migrations: Applying contenttypes.0001_initial...Traceback (most recent call last): File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 62, in execute return self.cursor.execute(sql) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\oracle\base.py", line 497, in execute return self.cursor.execute(query, self._param_generator(params)) cx_Oracle.DatabaseError: ORA-00955: name is already used by an existing object The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\__init__.py", line 364, in execute_from_command_line utility.execute() File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\base.py", line 330, in execute output = self.handle(*args, **options) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\core\management\commands\migrate.py", line 204, in handle fake_initial=fake_initial, File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\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 "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\executor.py", line 145, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\migrations\operations\models.py", line 97, in database_forwards schema_editor.create_model(model) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\base\schema.py", line 319, in create_model self.execute(sql, params or None) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\base\schema.py", line 136, in execute cursor.execute(sql, params) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 64, in execute return self.cursor.execute(sql, params) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\utils\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\utils.py", line 62, in execute return self.cursor.execute(sql) File "C:\Python36\lib\site-packages\django-1.11.20-py3.6.egg\django\db\backends\oracle\base.py", line 497, in execute return self.cursor.execute(query, self._param_generator(params)) django.db.utils.DatabaseError: ORA-00955: name is already used by an existing object
m0_38087678 2019-04-19
  • 打赏
  • 举报
回复
补充下: 我将settings.py中配置数据库换成sqlit3就可以正常,但是只要使用ORACLE就会有问题(可以连接上,但是执行命令有错),oracle版本是:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production DATABASES = { 'default': { 'ENGINE': 'django.db.backends.oracle', 'NAME': 'zgdbb', #数据库名称 'USER': 'bossgj', #用户名 'PASSWORD': 'xxxxx', #密码 'HOST': 'xxxx', #HOST 'PORT': '18094', #端口 } }

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧