I was following the tutorial at https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-ubuntu-20-04 to install Django on a Ubuntu 20.04 Droplet. When I try to access the server ip on port 8000 the server reponds with connection refused and I cannot test the page. I have a feeling it might be where django is binding but I whitelisted the port in UFW. There was another community post here https://www.digitalocean.com/community/questions/connection-refused-from-port-allowed-by-ufw but I am not able to run netstat and I tried to fix the binds by running python3 manage.py runserver ipaddress:8000 but still nothing. What am I missing?
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 there,
I could suggest checking if Django is binding on
0.0.0.0
so that it could be accessed from the outside world. You can do that with the following command:Feel free to share the output here.
If this is not the case, you might have to change the listen address from
127.0.0.1:8000
to0.0.0.0:8000
.Regards, Bobby