'utf8' codec can't decode byte 0xbf in position 50: invalid start byte

继续学习Django+Xadmin的实战项目中,目前遇到一个问题。

控制台报错是

"D:\py_program\PyCharm 2016.1.4\bin\runnerw.exe" C:\Users\qw\Envs\mxonline\Scripts\python.exe C:/Users/qw/PycharmProjects/mx_online/manage.py runserver 127.0.0.1:8000

Performing system checks...


C:\Users\qw\Envs\mxonline\lib\site-packages\DjangoUeditor\urls.py:11: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.

  url(r'^controller/$',get_ueditor_controller)     


System check identified no issues (0 silenced).

March 19, 2018 - 15:29:44

Django version 1.9, using settings 'mx_online.settings'

Starting development server at http://127.0.0.1:8000/

Quit the server with CTRL-BREAK.

Internal Server Error: /

Traceback (most recent call last):

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\core\handlers\base.py", line 149, in get_response

    response = self.process_exception_by_middleware(e, request)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\core\handlers\base.py", line 147, in get_response

    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\views\generic\base.py", line 68, in view

    return self.dispatch(request, *args, **kwargs)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\views\generic\base.py", line 88, in dispatch

    return handler(request, *args, **kwargs)

  File "C:\Users\qw\PycharmProjects\mx_online\apps\users\views.py", line 338, in get

    'course_orgs':course_orgs

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\shortcuts.py", line 67, in render

    template_name, context, request=request, using=using)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\template\loader.py", line 96, in render_to_string

    template = get_template(template_name, using=using)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\template\loader.py", line 32, in get_template

    return engine.get_template(template_name, dirs)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\template\backends\django.py", line 40, in get_template

    return Template(self.engine.get_template(template_name, dirs), self)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\template\engine.py", line 190, in get_template

    template, origin = self.find_template(template_name, dirs)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\template\engine.py", line 157, in find_template

    name, template_dirs=dirs, skip=skip,

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\template\loaders\base.py", line 40, in get_template

    contents = self.get_contents(origin)

  File "C:\Users\qw\Envs\mxonline\lib\site-packages\django\template\loaders\filesystem.py", line 25, in get_contents

    return fp.read()

  File "C:\Users\qw\Envs\mxonline\lib\codecs.py", line 314, in decode

    (result, consumed) = self._buffer_decode(data, self.errors, final)

UnicodeDecodeError: 'utf8' codec can't decode byte 0xbf in position 50: invalid start byte

[19/Mar/2018 15:44:38] "GET / HTTP/1.1" 500 134144

  以上标注了黑体的部分我都不太明白是什么意思。我试图解决第一个问题,

RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.

  url(r'^controller/$',get_ueditor_controller)     

我使用全局搜索,查找controller这个关键词,但是没有这个关键词。想到我可能是URL配置错了。但不知道具体是哪里错了。我现在使用的是Django 1.9


但是这个问题似乎不会影响我在网页访问


第二个问题是编码问题??

UnicodeDecodeError: 'utf8' codec can't decode byte 0xbf in position 50: invalid start byte

我查找了相关了问题,或许是html页面的编码出错了。但是我不知道怎么在Pycharm中去修改代码的编码形式。


请大神指点下我。

KIWI2018
浏览 2150回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP