Hi, I am a novice. I have installed django from the 1 click marketplace. I am getting the response from the ip url. Have added domain name and no problem ssh to the server. I have edited the settings and added the domain name but still getting: Invalid HTTP_HOST header: ‘www.mydomain.com’. You may need to add ‘www.mydomain.com’ to ALLOWED_HOSTS
Below is the setting.py:
def ip_addresses():
ip_list = ['159.223.76.95', '2400:6180:0:d0::fb9:8001']
for interface in netifaces.interfaces():
addrs = netifaces.ifaddresses(interface)
for x in (netifaces.AF_INET, netifaces.AF_INET6):
if x in addrs:
ip_list.append(addrs[x][0]['addr'])
return ip_list
ALLOWED_HOSTS = ip_addresses('www.mydomain.com')
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi @devrroslan,
So basically, you need to have the following:
I see you’ve created a function that takes a list of IP addresses but I’m not sure if it will run that way. Make sure to include the domain as well like the above.
Additionally, don’t forget to restart your gunicorn application after each change otherwise it won’t take it up.