在其中添加字段后,表单未运行

时间:2010-10-27 04:59:33

标签: python django

朋友们,我用form.py创建了一个表单,它运行得很顺利,但下次我在那个forms.py类中添加了两个新字段然后执行命令“python manage.py syncdb”它给出了我有以下错误:

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/pymodules/python2.6/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/pymodules/python2.6/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/pymodules/python2.6/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/usr/lib/pymodules/python2.6/django/core/management/commands/syncdb.py", line 52, in handle_noargs
    cursor = connection.cursor()
  File "/usr/lib/pymodules/python2.6/django/db/backends/__init__.py", line 75, in cursor
    cursor = self._cursor()
  File "/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py", line 174, in _cursor
    self.connection = Database.connect(**kwargs)
pysqlite2.dbapi2.OperationalError: unable to open database file

2 个答案:

答案 0 :(得分:1)

对表单进行更改不会影响数据库架构,更改表单后无需运行syncdb。 您收到的错误源于其他地方。

答案 1 :(得分:0)

似乎问题不在于您的forms.py,而在于您的sqlite数据库file.can您再次删除了sqlite数据库文件和syncdb


~$  rm default.db
~$ manage.py syncdb