【发布时间】:2016-05-08 15:59:38
【问题描述】:
我想开始学习 Django 框架,但是我已经遇到了一个问题。我已经设置了 Django 和所有东西,但是当我开始运行服务器时,我的问题就开始了。我写完pythonmanage.py runserver:
C:\Users\Programiranje\Desktop\Django\mysite> python manage.py runserver
它会抛出这样的异常:
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them. May 08, 2016 - 17:47:21 Django version 1.9.6, using settings 'mysite.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 0x00000000044E3488>
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\django-1.9.6py3.4.egg\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs) File "C:\Python34\lib\site-packages\django-1.9.6-py3.4.egg\django\core\management\commands\runserver.py", line 137, in inner_run
ipv6=self.use_ipv6, threading=threading) File "C:\Python34\lib\site-packages\django-1.9.6-py3.4.egg\django\core\servers\basehttp.py", line 188, in run
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6) File "C:\Python34\lib\site-packages\django-1.9.6-py3.4.egg\django\core\servers\basehttp.py", line 73, 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-1.9.6-py3.4.egg\django\core\servers\basehttp.py", line 77, 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 135, in server_bind
self.server_name = socket.getfqdn(host) File "C:\Python34\lib\socket.py", line 463, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8e in position 0: invalid start byte
非常感谢任何帮助!
【问题讨论】:
-
您是否尝试过按照错误提示执行的操作?
Run 'python manage.py migrate'? -
是的,我有。但它仍然没有工作,因为迁移没有连接到底部错误。
-
你安装的是什么版本的python和django?
-
我做了一些搜索,他们实际上说问题发生是因为计算机名称包含非 ascii 字符,例如 ru.stackoverflow.com/questions/485310/… %80/485615#485615
-
谢谢你们 - 重命名我的电脑确实对我有用:D