Why is Django throwing error “DisallowedHost at /”?

后端 未结 5 1360
难免孤独
难免孤独 2020-12-13 23:19

I am setting up my own Django server using this Digital Ocean tutorial. I created the Django framework following each step, and ran the server using this command:

         


        
5条回答
  •  没有蜡笔的小新
    2020-12-14 00:01

    Include both ('www.name.com', 'ip.ip.ip.ip') Set Debug = True, then retry the IP & URL Address.

    Go to the Traceback section, find the message [ raise DisallowedHost(msg) ] click -> ▼ Local vars

    It will show the incoming domain name and the settings for allowed hosts:

    *Variable       Value
    *allowed_hosts  ['ip.ip.ip.ip', 'name.com']
    *domain          'something.com'
    *
    

    Copy the incoming value into your settings.py. If the you see old settings restart the server\nginx

提交回复
热议问题