Question

Connection Refused Port 8000 Django on Ubuntu 20.04

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?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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:

netstat -plant | grep 8000

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 to 0.0.0.0:8000.

Regards, Bobby