Home > Mobile >  Django project cannot be accessed using IPV6 address
Django project cannot be accessed using IPV6 address

Time:03-04

I am running my Django project on a ubuntu server. I have changed the allowed host in settings.py

ALLOWED_HOSTS = ['my_IPV4', 'my_IPV6', 'localhost']

I allowed access to port 8000 by sudo ufw allow 8000.

I run the server by python manage.py runserver 0.0.0.0:8000 however I can only access the IPV4 address but the IPV6 address on port 8000 is not reachable. My IPV6 address is active but port 8000 seems not working. Did I miss something on configuring IPV6?

CodePudding user response:

Add "[::1]" in Allowed host setting, then run :

python manage.py runserver --ipv6 "[::1]:8000"

Reference: https://docs.djangoproject.com/en/4.0/ref/settings/#allowed-hosts

  • Related