django-admin.py startproject HelloWorld
cd HelloWorld
python manage.py runserver 119.23.175.75:8000
报错:
[root@iZwz9j0rhuuld23m4jpvjiZ HelloWorld]# python manage.py runserver 119.23.175.75:8000 Performing system checks... System check identified no issues (0 silenced). You have 13 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. August 10, 2017 - 01:22:59 Django version 1.10.7, using settings 'HelloWorld.settings' Starting development server at http://119.23.175.75:8000/ Quit the server with CONTROL-C. Invalid HTTP_HOST header: '119.23.175.75:8000'. You may need to add u'119.23.175.75' to ALLOWED_HOSTS. [10/Aug/2017 01:23:15] "GET / HTTP/1.1" 400 60326 Invalid HTTP_HOST header: '119.23.175.75:8000'. You may need to add u'119.23.175.75' to ALLOWED_HOSTS. [10/Aug/2017 01:23:16] "GET /favicon.ico HTTP/1.1" 400 60408 ^C[root@iZwz9j0rhuuld23m4jpvjiZ HelloWorld]# python manage.py migrate
解决办法:
python manage.py migrate
又报错:
[root@iZwz9j0rhuuld23m4jpvjiZ HelloWorld]# python manage.py runserver 119.23.175.75:8000 Performing system checks... System check identified no issues (0 silenced). August 10, 2017 - 01:24:13 Django version 1.10.7, using settings 'HelloWorld.settings' Starting development server at http://119.23.175.75:8000/ Quit the server with CONTROL-C. Invalid HTTP_HOST header: '119.23.175.75:8000'. You may need to add u'119.23.175.75' to ALLOWED_HOSTS. [10/Aug/2017 01:24:29] "GET / HTTP/1.1" 400 60311 Invalid HTTP_HOST header: '119.23.175.75:8000'. You may need to add u'119.23.175.75' to ALLOWED_HOSTS. [10/Aug/2017 01:24:29] "GET /favicon.ico HTTP/1.1" 400 60393 Invalid HTTP_HOST header: '119.23.175.75:8000'. You may need to add u'119.23.175.75' to ALLOWED_HOSTS. [10/Aug/2017 01:24:32] "GET / HTTP/1.1" 400 60446 Invalid HTTP_HOST header: '119.23.175.75:8000'. You may need to add u'119.23.175.75' to ALLOWED_HOSTS.
解决办法:
settings.py ALLOWED_HOSTS = [] 修改为: ALLOWED_HOSTS = ['*']
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。