'Django cannot set domain name

I want to set domain name from cloudflare to django.

I set settings.py like this.

ALLOWED_HOSTS = ["10.x.x.x","20.x.x.x","myweb.com"]

which 10.x.x.x is private ip address and 20.x.x.x is public ip address. The public ip is in Firewall NAT.

I run Django server by use command

python manage.py runserver myweb.com:8000

It show error like this.

Error: [Errno 11001] getaddrinfo failed

If I run with public ip like this command.

python manage.py runserver 20.x.x.x:8000

It show error like this.

Error: That IP address can't be assigned to.

If I run with private ip it have no error.

python manage.py runserver 10.x.x.x:8000

I set domain in cloudflare myweb.com to public ip 20.x.x.x. when open http://myweb.com:8000 it not found my website. How to set domian for Django?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source