当我使用python manage.py runserver
时,得到如下追溯:
Performing system checks...
System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x7f518da18230>
Traceback (most recent call last):
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 124, in inner_run
self.check_migrations()
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/core/management/base.py", line 437, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
self.build_graph()
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 203, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
self.ensure_schema()
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 56, in ensure_schema
with self.connection.schema_editor() as editor:
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py", line 27, in __enter__
return super(DatabaseSchemaEditor, self).__enter__()
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 86, in __enter__
self.atomic.__enter__()
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/transaction.py", line 184, in __enter__
connection.set_autocommit(False, force_begin_transaction_with_broken_autocommit=True)
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 389, in set_autocommit
self._start_transaction_under_autocommit()
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in _start_transaction_under_autocommit
self.cursor().execute("BEGIN")
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/data/program/mtl/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 336, in execute
return Database.Cursor.execute(self, query)
ValueError: the query contains a null character
我用的是什么: django 1.10 python2.7 的virtualenv
settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
我搜索了很长时间。有没有人可以帮助我?或者像我一样出现同样的问题?