在eclipse中使用sqlite3。 这是我第一次使用它,当我尝试创建数据库时,这是我得到的错误:
Traceback (most recent call last):
File "F:\New wrokspace\books\books\manage.py", line 14, in <module>
execute_manager(settings)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 438, in execute_manager
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 220, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 286, in handle
app_output = self.handle_app(app, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\sqlall.py", line 19, in handle_app
return u'\n'.join(sql_all(app, self.style, connections[options.get('database', DEFAULT_DB_ALIAS)])).encode('utf-8')
File "C:\Python27\lib\site-packages\django\core\management\sql.py", line 146, in sql_all
return sql_create(app, style, connection) + sql_custom(app, style, connection) + sql_indexes(app, style, connection)
File "C:\Python27\lib\site-packages\django\core\management\sql.py", line 26, in sql_create
tables = connection.introspection.table_names()
File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 791, in table_names
cursor = self.connection.cursor()
File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", line 207, in _cursor
self.connection = Database.connect(**kwargs)
sqlite3.OperationalError: unable to open database file
Finished "F:\New wrokspace\books\books\manage.py sqlall books" execution.
有人可以告诉我如何在eclipse上创建和打开sqlite3数据库吗?
由于
答案 0 :(得分:0)
要使用Django创建数据库,您必须编写模型,将应用程序放在settings.INSTALLED_APPS
中,然后:
python manage.py syncdb
sqlall命令打印给定应用程序名称的CREATE TABLE和初始数据SQL语句。