Error: [Errno 11001] getaddrinfo failed

在启动django项目是遇到:Error: [Errno 11001] getaddrinfo failed错误

在ubuntu中运行如下命令就可以,但把项目转移到windows10中运行就出现错误:

# --insecure 参数强制django处理静态文件,当关闭debug是加参数(--insecute)
python manage.py  runserver 0:8000 --insecure
# 或者
python manage.py  runserver 0:8000

settings.py文件中DEBUG代码

DEBUG = False
ALLOWED_HOSTS = ["*"]

在windows10中运行下面命令,就可以解决错误了

python manage.py runserver 0.0.0.0:8000 --insecute
# 或者
python manage.py runserver 0.0.0.0:8000

为您推荐:

  1. Python之深浅拷贝
  2. Python标准数据类型
  3. python中break,continue,pass,else的用法和区别详解
原文地址:https://www.cnblogs.com/oito/p/12149485.html