Python 表单中添加字段后未运行

Python 表单中添加字段后未运行,python,django,Python,Django,Hie friends,我使用forms.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/pytho

Hie friends,我使用forms.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
回溯(最近一次呼叫最后一次):
文件“manage.py”,第11行,在
执行\u管理器(设置)
文件“/usr/lib/pymodules/python2.6/django/core/management/_init__.py”,第438行,在执行管理器中
utility.execute()
文件“/usr/lib/pymodules/python2.6/django/core/management/_init__.py”,第379行,在execute中
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“/usr/lib/pymodules/python2.6/django/core/management/base.py”,第191行,从_argv运行
self.execute(*args,**选项._dict__;
文件“/usr/lib/pymodules/python2.6/django/core/management/base.py”,第220行,在execute中
输出=self.handle(*args,**选项)
文件“/usr/lib/pymodules/python2.6/django/core/management/base.py”,第351行,在handle中
返回self.handle\u noargs(**选项)
handle_noargs中的文件“/usr/lib/pymodules/python2.6/django/core/management/commands/syncdb.py”,第52行
cursor=connection.cursor()
文件“/usr/lib/pymodules/python2.6/django/db/backends/_init__.py”,第75行,光标
cursor=self.\u cursor()
文件“/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py”,第174行,在光标处
self.connection=Database.connect(**kwargs)
pysqlite2.dbapi2.2错误:无法打开数据库文件

问题似乎不在forms.py上,而在sqlite数据库文件上。是否可以删除sqlite数据库文件并再次同步数据库


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

更改表单不会影响数据库架构,更改表单后无需运行syncdb。 您收到的错误的根源在别处