2
回答
Django1.7 syncdb报错
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   
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'")

数据库都是空的,怎么就违反唯一键约束了呢?



举报
BigZ
发帖于3年前 2回/599阅
顶部