发生Django 2.1.5服务器错误。请联系管理员“错误:UnicodeDecodeError

时间:2019-01-23 00:34:45

标签: python django

我与Django有一个小问题,那就是我对服务器执行运行python manage.py runserver时向我显示了CMD中的此错误:

错误

    Traceback (most recent call last):
  File "c:\python36\Lib\wsgiref\handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\contrib\stat
icfiles\handlers.py", line 65, in __call__
    return self.application(environ, start_response)
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\core\handler
s\wsgi.py", line 142, in __call__
    response = self.get_response(request)
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\core\handler
s\base.py", line 78, in get_response
    response = self._middleware_chain(request)
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\core\handler
s\exception.py", line 36, in inner
    response = response_for_exception(request, exc)
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\core\handler
s\exception.py", line 90, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), s
ys.exc_info())
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\core\handler
s\exception.py", line 125, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\views\debug.
py", line 94, in technical_500_response
    html = reporter.get_traceback_html()
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\site-packages\django\views\debug.
py", line 332, in get_traceback_html
    t = DEBUG_ENGINE.from_string(fh.read())
  File "C:\Users\Mo7ammed\Desktop\test4web\lib\encodings\cp1252.py", line 23, in
 decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 273719: c
haracter maps to <undefined>
[23/Jan/2019 02:56:03] "GET /favicon.ico HTTP/1.1" 500 59

并在浏览器中:server error occurred. Please contact the administrator

注意:我在virtualenv上运行了该项目,并且没有在该项目上编写任何代码。

我该如何解决:)谢谢。

settings.py

DEBUG = True

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

0 个答案:

没有答案