python django启动报错

创建好django项目之后,runserver启动报错……

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate‘ to apply them.
April 05, 2019 - 21:59:41
Django version 2.2, using settings ‘yaradish.settings‘
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "c:\program files (x86)\python37-32\Lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "c:\program files (x86)\python37-32\Lib\threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "E:\python\demo-yaradish\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "E:\python\demo-yaradish\lib\site-packages\django\core\management\commands\runserver.py", line 139, in inner_run
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
  File "E:\python\demo-yaradish\lib\site-packages\django\core\servers\basehttp.py", line 203, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "E:\python\demo-yaradish\lib\site-packages\django\core\servers\basehttp.py", line 67, in __init__
    super().__init__(*args, **kwargs)
  File "c:\program files (x86)\python37-32\Lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "c:\program files (x86)\python37-32\Lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "c:\program files (x86)\python37-32\Lib\http\server.py", line 139, in server_bind
    self.server_name = socket.getfqdn(host)
  File "c:\program files (x86)\python37-32\Lib\socket.py", line 676, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xd1 in position 0: invalid continuation byte

原因及解决方案:

一般来说编码错误是由中文引起的。从 traceback 最后一栈落在 gethostbyaddr 上可以看出:你电脑的主机名多半是设成了中文了。然后查看了自己的主机名,确实为中文

修改计算机主机名为英文

查看主机名

计算机右键属性,点击高级系统设置,图中标记即为主机名,修改如箭头步骤所示。修改后要重启电脑。

原文地址:https://www.cnblogs.com/yaradish/p/10659975.html

时间: 2024-10-12 04:11:51

python django启动报错的相关文章

Python IDLE启动报错

电脑捣鼓成了64位操作系统,相应的一些工具要重装.今日将以前32位python 卸载,重装成64位的,然后默认安装成功.然后设置系统变量. 进入我的电脑->属性->高级->环境变量->系统变量 ,编辑path  变量: 量名:PATH 变量值:;C:\Python27 保存成功后,打开运行对话框,输入cmd回车,输入命令python,提示正常 启动IDLE(python GUI)时,报错:IDLE's subprocess didn't make connection . eith

新装python环境启动django程序报错

个人独立博客 http://www.xbman.cn/ 出处:http://www.xbman.cn/article/1 django启动报错 django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3 解决方法 centos yum install python-deve

解决window7 x64位Anaconda启动报错:AttributeError: '_NamespacePath' object has no attribute 'sort'

最近论文需要用到python做数据分析,python语法简单,但是Windows下安装第三方包恶心的要命,statsmodels用pip死活安装不上,网上查了说包相互依赖windows下的pip不能下载全,还有好几个其他的统计包也是如此,整晕了算. 看网上有些python大牛推荐Anaconda,可以解决包的问题,于是卸载本地的python,从官网上下了个Anconda玩玩,结果遇到新问题. 问题如下: An unexpected error has occurred. Please consi

Django 运行报错 ImportError: No module named 'PIL'

importError: No module named pil WIN7 64位系统安装 Python PIL 首先通过easy_install安装 说找不到pil模块. 第二通过去官网找:http://www.pythonware.com/products/pil/ 找了几个版本安装版的没有64位的,源码包的下载无法安装说要安装vs2008我也安装了还是不行.最后在这个地址找到:http://www.lfd.uci.edu/~gohlke/pythonlibs/ Pillow is a re

Python3.5以上Celery4.2.1启动报错:ImportError: cannot import name 'LRUCache' from 'kombu.utils.functional'

服务器:Centos7 Python版本:Python 3.7.0 Celery版本:4.2.1 Python3.5以上,OrderDict不允许在迭代过程中进行修改,导致LRUCache.update失败,可能引起的此问题. 解决方法,安装dev版的celery python3 -m pip install -e git+https://github.com/celery/kombu.git#egg=kombu 参考链接: https://github.com/celery/celery/is

Nginx部署Django项目报错 KeyError: 'REQUEST_METHOD'

这个问题是应为Nginx的配置文件有问题: 要使用uwsgi启动Django的话要有以下配置: upstream djangos14{ # nginx负载均衡配置: server 10.0.0.10:9999; #server 10.0.0.11:80; } server { listen 80; server_name www.s14hanju.com; location / { # 要使用uwsgi,代理就不要用proxy_pass了,要使用uwsgi_pass: uwsgi_pass dj

安装mongodb后启动报错libstdc++

安装mongo后启动报错如下图 显然说是libstdc++.so文件版本的问题,这种一般都是gcc版本太低了 接着查询gcc的版本    strings /usr/lib/libstdc++.so.6 | grep GLIBCXX 接着去找下libstdc++.so新点的版本,一定要根据自己的系统版本去找啊,由于我找错了版本报错系统位数不对 随后下载了一个64位的libstdc++.so.6.0.17的文件,然后软链成libstdc++.so.6 ln -s libstdc++.so.6.0.1

tomcat启动报错:java.net.BindException: Permission denied <null>:80

1,启动报错显示 [org.springframework.web.servlet.DispatcherServlet]FrameworkServlet 'springMvc': initialization completed in 382 ms Jun 01, 2015 6:39:06 PM org.apache.coyote.http11.Http11Protocol start SEVERE: Error starting endpoint java.net.BindException:

Tomcat启动报错[org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed

Tomcat启动报错: [org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed Unable to load configuration. - bean - jar:file:/E:/SoftwareDevelopment/Software/Eclipse4.3/eclipse-jee-kepler-SR1-win32-x86_64/Workspace/.metadata/.plugins/org.ec