H:\dev\AppServ\www\PythonProjects\DjangoTest>python manage.py syncdb Operations to perform: Apply all migrations: admin, contenttypes, auth, sessions Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying sessions.0001_initial... OK Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "H:\dev\python2.7\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line utility.execute() File "H:\dev\python2.7\lib\site-packages\django\core\management\__init__.py", line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "H:\dev\python2.7\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "H:\dev\python2.7\lib\site-packages\django\core\management\base.py", line 338, in execute output = self.handle(*args, **options) File "H:\dev\python2.7\lib\site-packages\django\core\management\base.py", line 533, in handle return self.handle_noargs(**options) File "H:\dev\python2.7\lib\site-packages\django\core\management\commands\syncd b.py", line 27, in handle_noargs call_command("migrate", **options) File "H:\dev\python2.7\lib\site-packages\django\core\management\__init__.py", line 115, in call_command return klass.execute(*args, **defaults) File "H:\dev\python2.7\lib\site-packages\django\core\management\base.py", line 338, in execute output = self.handle(*args, **options) File "H:\dev\python2.7\lib\site-packages\django\core\management\commands\migra te.py", line 164, in handle emit_post_migrate_signal(created_models, self.verbosity, self.interactive, c onnection.alias) File "H:\dev\python2.7\lib\site-packages\django\core\management\sql.py", line 268, in emit_post_migrate_signal using=db) File "H:\dev\python2.7\lib\site-packages\django\dispatch\dispatcher.py", line 198, in send response = receiver(signal=self, sender=sender, **named) File "H:\dev\python2.7\lib\site-packages\django\contrib\contenttypes\managemen t.py", line 56, in update_contenttypes ContentType.objects.using(using).bulk_create(cts) File "H:\dev\python2.7\lib\site-packages\django\db\models\query.py", line 409, in bulk_create self._batched_insert(objs_without_pk, fields, batch_size) File "H:\dev\python2.7\lib\site-packages\django\db\models\query.py", line 938, in _batched_insert using=self.db) File "H:\dev\python2.7\lib\site-packages\django\db\models\manager.py", line 92 , in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "H:\dev\python2.7\lib\site-packages\django\db\models\query.py", line 921, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "H:\dev\python2.7\lib\site-packages\django\db\models\sql\compiler.py", li ne 920, in execute_sql cursor.execute(sql, params) File "H:\dev\python2.7\lib\site-packages\django\db\backends\utils.py", line 81 , in execute return super(CursorDebugWrapper, self).execute(sql, params) File "H:\dev\python2.7\lib\site-packages\django\db\backends\utils.py", line 65 , in execute return self.cursor.execute(sql, params) File "H:\dev\python2.7\lib\site-packages\django\db\utils.py", line 94, in __ex it__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "H:\dev\python2.7\lib\site-packages\django\db\backends\utils.py", line 65 , in execute return self.cursor.execute(sql, params) File "H:\dev\python2.7\lib\site-packages\django\db\backends\mysql\base.py", li ne 128, in execute return self.cursor.execute(query, args) File "H:\dev\python2.7\lib\site-packages\MySQLdb\cursors.py", line 205, in exe cute self.errorhandler(self, exc, value) File "H:\dev\python2.7\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue django.db.utils.IntegrityError: (1062, "Duplicate entry 'auth-group' for key 'dj ango_content_type_app_label_3ec8c61c_uniq'")
数据库都是空的,怎么就违反唯一键约束了呢?
1.7好像没syncdb这个命令了吧。请问这个问题解决了吗??
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。