Hie friends, I made a form using the class forms.py it was running smoothly, but next time when I added two new fields in that forms.py class then on executing the command "python manage.py syncdb " it gives me the following error:
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/lib/pymodules/python2.6/django/core/management/__in开发者_开发技巧it__.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
Making changes to forms does not affect you database schema, there is no need to run syncdb after changing a form. The error you are receiving has its roots elsewhere.
it seems the problem is not with your forms.py but with your sqlite database file.can you delete the sqlite database file and syncdb again
~$ rm default.db
~$ manage.py syncdb
精彩评论