[Fixed]-How to access django development server on virtual machine from actual computer

15👍

I was able to get @Kerberos answer to work. (not enough points to comment so I’m adding it as a seperate answer).

I am running Ubuntu 12.04 LTS in a guest OS in VMWare. The host laptop is running Windows 8.

As mentioned by Kerberos, in VMWare, go to Player ==> Manage ==> Virtual Machine Settings...

On the Hardware tab, select Network Adaptor, then select the radio button for Bridged: Connect directly to the physical network. Select OK

In the VM, the network connection information should now have the same IP address of the host OS internet connection. In my case: 192.168.1.141 (yours will vary).

In the VM, start Django using python manage runserver 192.168.1.141:8000

Using this method, I am able to access the webserver running in the VM at this IP address from within the VM, from host machine, and from other systems on the same 192.168.1.xxx network.

17👍

You can try running the server on 0.0.0.0

python manage.py runserver 0.0.0.0:8000

The IP address 0.0.0.0 means “all IP addresses on the local machine” (or all IPv4 addresses on the local machine).

Next, you will need the ip address of your VM. Visting http://<ip_address_of_vm>:8000 on other computers should access the django development server on your VM.

Note: If your VM only has an internal IP (e.g. 192.168.x.x) then only computers on the same network can visit the VM.

2👍

to access virtual machine (guest) from outside the host computer, you have to set the guest network mode to bridge

Bridge-mode connects the guest to the actual network so that other machines can connect to it

Leave a comment