1
votes

My setup - Ubuntu 14.04 running on VirtualBox 4.3.24 client hosted on Windows 7.

I'd like to access my Django 1.7 dev server from another local PC, referenced by hostname rather than IP address - as the IP address could change.

./manage.py runserver 0.0.0.0:8000 works fine. The client PC browser can see my app on 192.168.2.xx:8000 But if I reboot the VirtualBox xx could become yy.

Is it possible to start runserver with a hostname?

Ideally I'd like to access the Django app with something like http://djangodev:8000 in the client browser. (I tried ./manage.py runserver djangodev:8000 - but 'Name or service not known')

Should I be looking to setup VirtualBox with a static IP instead of looking to configure runserver?

Many Thanks.

1
This question isn't in fact's django related, it is only about network configuration. You have to change virtual machine setup to make the IP static. There is no way for django server to affect url resolving on client machine.Frax

1 Answers

0
votes

With a fixed ip address on your VM and I guess for your needs you just want the VM to be available by that name for your development machine, you can edit your /etc/hosts file to give it a ip-to-host name mapping. I'm assuming you are on a unix machine.

Add a line like this:

192.168.2.123 djangodev