Vagrant's hosted Django can't be accessed

time to read 1 min | 83 words

A few days ago I am starting to use vagrant to develop our Django project at Polatic. After I finished installing project’s dependencies and run python manage.py runserver, I can’t accessed 127.0.0.1:8000 from my browser even after I enabled vagrant’s port forwarding.

The thing is, django’s default settings will listen at 127.0.0.1 which can only be accessed from vagrant. So we need django to listen to all network interfaces by binding it to 0.0.0.0. Running python manage.py runserver 0.0.0.0:8000 will fix this problem.