我正面临着启动runserver django?

时间:2016-10-18 14:08:33

标签: django sqlite

运行服务器时出现以下错误。我使用Django === 1.10.2和默认的sqlite3数据库作为后端。但我有以下例外:

python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x7f56983c3140>
Traceback (most recent call last):
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 124, in inner_run
    self.check_migrations()
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/core/management/base.py", line 437, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 203, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
  File "/home/nidhinjames/popo/popo/mysite/venv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in ensure_schema
    raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 6: ordinal not in range(128)

任何解决方案都可以理解????

1 个答案:

答案 0 :(得分:0)

似乎你在某处设置了一个奇怪的角色,很可能是在django设置中指定的sqlite文件的名称。

Django试图做raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc) - 当这样做时遇到UNICODE错误,该错误告诉0xf1不是ASCII的一部分。根据{{​​3}},这是字符±。由于django绝对不会将其用作表名,我猜它必须与文件名相关。

如果不是这种情况,请尝试项目文件夹中的grep '±' .以查找此字符的用法。 HTH