本文介绍了Unicoderecodeerror与runserver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在设置了所有 django 要求之后,我尝试了 runserver 命令,我发现错误: p>

After setting up all what django requires, I tried the runserver command and I caught an error:

From:

c:\sue>python manage.py runserver
Validating models...

0 errors found
April 16, 2014 - 15:02:42
Django version 1.6.2, using settings 'sue.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000000003890048>
Traceback (most recent call last):
  File "C:\python34\lib\site-packages\django\utils\autoreload.py", line 93, in wrapper fn(*args, **kwargs)
  File "C:\python34\lib\site-packages\django\core\management\commands\runserver.py", line 127, in inner_run ipv6=self.use_ipv6, threading=threading)
  File "C:\python34\lib\site-packages\django\core\servers\basehttp.py", line 167, in run httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\python34\lib\site-packages\django\core\servers\basehttp.py", line 109, in __init__ super(WSGIServer, self).__init__(*args, **kwargs)
  File "C:\python34\lib\socketserver.py", line 430, in __init__ self.server_bind()
  File "C:\python34\lib\site-packages\django\core\servers\basehttp.py", line 113, in server_bind super(WSGIServer, self).server_bind()
  File "C:\python34\lib\wsgiref\simple_server.py", line 50, in server_bind HTTPServer.server_bind(self)
  File "C:\python34\lib\http\server.py", line 137, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\python34\lib\socket.py", line 460, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 8: invalid continuation byte

我使用的是Windows 7 x64,python 3.4和django 1.6.2。这个错误是什么意思?

I am using Windows 7 x64, python 3.4 and django 1.6.2. What does this error mean?

推荐答案

这听起来像。如果您的计算机名称具有非ASCII字符,则会失败。您可以:

This sounds like this Python issue. If your computer name has non-ASCII characters this will fail. You may:


  1. 使用显式主机和端口发出runserver命令: python manage.py runserver 127.0.0.1: 8000

  2. 将您的计算机名称更改为仅包含ASCII字符的字符串。

这篇关于Unicoderecodeerror与runserver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:29