- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我创建了一个托管在 Azure 上的 Django 应用程序,因此我使用 Visual Studio 的 Python 工具来开发该应用程序。我在根应用程序的 models.py 中创建了一个名为 Client 的模型。它实际上是一个模型表单,因为表列都链接到我创建的表单中的字段。我使用的是 MySQL,连接器是 MySQLClient,因为我使用的是 Python 3.4。我运行了 python manage.pysyncdb
并显示了以下内容:
Operations to perform:
Synchronize unmigrated apps: staticfiles, messages, VSpace
Apply all migrations: auth, sessions, contenttypes, sites
Synchronizing apps without migrations:
Creating tables...
Creating table VSpace_Client
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying auth.0001_initial...Traceback (most recent call last):
这就是它失败的地方。我正在研究这个,我发现了一些关于创建 super 用户的信息。我尝试过,但在输入凭据后它也失败了。有谁知道为什么会发生这种情况?
编辑1:
回溯:
Traceback (most recent call last):
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\mysql\base.py", line 124, in execute
return self.cursor.execute(query, args)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 220, in execute
self.errorhandler(self, exc, value)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
raise errorvalue
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 209, in execute
r = self._query(query)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 371, in _query
rowcount = self._do_query(q)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 335, in _do_query
db.query(q)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\connections.py", line 280, in query
_mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1050, "Table 'auth_permission' already exists")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\manage.py", line 17, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
utility.execute()
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\base.py", line 444, in execute
output = self.handle(*args, **options)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\commands\syncdb.py", line 25, in handle
call_command("migrate", **options)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\base.py", line 444, in execute
output = self.handle(*args, **options)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\core\management\commands\migrate.py", line 221, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\migrations\executor.py", line 110, in migrate
self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\migrations\executor.py", line 148, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\migrations\migration.py", line 115, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\migrations\operations\models.py", line 59, in database_forwards
schema_editor.create_model(model)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\base\schema.py", line 286, in create_model
self.execute(sql, params or None)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\base\schema.py", line 111, in execute
cursor.execute(sql, params)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\utils\six.py", line 658, in reraise
raise value.with_traceback(tb)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\django\db\backends\mysql\base.py", line 124, in execute
return self.cursor.execute(query, args)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 220, in execute
self.errorhandler(self, exc, value)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
raise errorvalue
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 209, in execute
r = self._query(query)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 371, in _query
rowcount = self._do_query(q)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\cursors.py", line 335, in _do_query
db.query(q)
File "C:\Users\Vinu\Google Drive\VVN Group\VSPace\VSpace Website\VSpace\VSpace\env\lib\site-packages\MySQLdb\connections.py", line 280, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1050, "Table 'auth_permission' already exists")
The Python REPL process has exited
最佳答案
首先,尝试运行 python manage.py migrate
而不是 syncdb
。如果我没记错的话,syncdb
命令已被弃用,取而代之的是 makemigrations
和 migrate
命令。尝试一下,事情应该会变得更好。
相关:您使用的是哪个版本的 Django?
关于python - Djangosyncdb 在应用 auth.0001_initial 时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32189712/
这是我的代码。 var express = require("express"); var router = express.Router(); var mangojs = require("mang
知道为什么我在运行下面的代码时会收到以下错误: Traceback (most recent call last): File "C:\pytests\mthread1.py", line 25,
我正在尝试学习 Python 3 上的线程。我做了一个示例代码: import time import threading def myfunction(string,sleeptime,lock,*
下面的代码不会在我的 ASP.NET 页面中呈现,并且单击按钮后我的页面会发回。 Sys dot WebForms dot PageRequestManager dot _initialize('Sc
我在网站上使用 ASP.NET 2.0 Ajax 扩展。与往常一样,本地一切正常,但远程网站不使用 ajax 调用。我的本地服务器安装了 ASP.NET Ajax 扩展,但远程服务器没有。我知道我应该
我是一名优秀的程序员,十分优秀!