在django中,我在现有数据库中创建了新模型。在同步模型时,它会显示错误。我无法解决这些问题。我正在使用mysql作为数据库。我添加了错误代码。请分享您的想法。
python manage.py syncdb
Creating tables ...
Creating table registration_securityquestions
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 102, in handle_noargs
cursor.execute(statement)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (3, "Error writing file './userregdb/registration_securityquestions.frm' (Errcode: 28)")
答案 0 :(得分:2)
来自MySQL doc:
上述错误是Windows的典型消息; Unix消息类似。
一个解决方法是使用--tmpdir
选项启动mysqld,或者将选项添加到选项文件的[mysqld]
部分。例如,要指定C:\temp
目录,请使用以下行:
[mysqld]
tmpdir=C:/temp