Connecting to a Django app on DigitalOcean

If you just run a Django app on Digital Ocean, it will let you connect from within the VM, but not outside. E.g.:

python manage.py runserver

By default this seems to listen on 127.0.0.1:8000. It is bound to the local network interface, so it doesn’t even see traffic from outside. The problem actually isn’t a firewall (this doesn’t seem to get configured on Ubuntu by default)

To fix this, run it this way instead:

python manage.py runserver 0.0.0.0:8000

Leave a Reply

Your email address will not be published. Required fields are marked *