在django的settings中. 将DEBUG 设置为False. 会出现
#python manage.py runserver 8888
CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.
#####################################################
提示DEBUG为False时,必须设置settings.ALLOWED_HOSTS .
ALLOWED_HOSTS = [ '.example.com', # Allow domain and subdomains '.example.com.', # Also allow FQDN and subdomains ]
或者您需要设置所有的均可访问.那么可以这样设置.
ALLOWED_HOSTS = ['*']
任何用户均可以访问.
然后再访问下.恢复正常.
相关django官方文档.
https://docs.djangoproject.com/en/1.7/ref/settings/
网友评论