By devrroslan
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')
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @devrroslan,
So basically, you need to have the following:
ALLOWED_HOSTS = ['<domain name>', '<Ip address>']
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.