首页 新闻 搜索 专区 学院

Django ubuntu 环境 使用sqlite3 报错

0
悬赏园豆:200 [已关闭问题] 关闭于 2017-09-19 05:47

如题 windows 环境下 python 3.6.2  django1.11.5 使用sqlite存储  django-admin 页面访问数据库没有问题  

换做ubuntu 环境下 python 3.5.3  django 1.11.5 使用sqlite存储   网页显示数据库内容无问题    django-admin 下使用数据库 直接报错  说的是字符编码问题?

附报错代码:(关键位置已加粗)

Traceback (most recent call last):
File "/usr/lib/python3.5/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/home/ericvv/.local/lib/python3.5/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/home/ericvv/.local/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 157, in __call__
response = self.get_response(request)
File "/home/ericvv/.local/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in get_response
response = self._middleware_chain(request)
File "/home/ericvv/.local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/ericvv/.local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/ericvv/.local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/ericvv/.local/lib/python3.5/site-packages/django/views/debug.py", line 85, in technical_500_response
return HttpResponse(html, status=status_code, content_type='text/html')
File "/home/ericvv/.local/lib/python3.5/site-packages/django/http/response.py", line 303, in __init__
self.content = content
File "/home/ericvv/.local/lib/python3.5/site-packages/django/http/response.py", line 336, in content
content = self.make_bytes(value)
File "/home/ericvv/.local/lib/python3.5/site-packages/django/http/response.py", line 247, in make_bytes
return bytes(value.encode(self.charset))
File "/home/ericvv/.local/lib/python3.5/site-packages/django/utils/functional.py", line 15, in _curried
return _curried_func(*(args + moreargs), **dict(kwargs, **morekwargs))
File "/home/ericvv/.local/lib/python3.5/site-packages/django/utils/safestring.py", line 105, in _proxy_method
data = method(self, *args, **kwargs)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcb8' in position 7157: surrogates not allowed

问题补充:

补充 问题 同样的代码  windows 没问题 ubuntu 出现问题  求解决方法

莱立佰的主页 莱立佰 | 菜鸟二级 | 园豆:202
提问于:2017-09-19 05:09
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册