Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see the Django development server in VMWare?

Tags:

django

vmware

I am trying to connect to a Django development server, running in OS X localhost:8000, from VMWare running Windows.

I've tried various combinations of settings, but none of them seem to work:

  • Running the Django server on localhost:8000, and in Windows, connecting to the IP address assigned to the Mac by VMWare, i.e. 192.168.XX.XX:8000
  • Running the Django server on port 80
  • Running the Django server on the Mac's IP assigned by VMWare, e.g. python manage.py runserver 192.168.XX.XX:8000

None of these seem to work. I have an Apache server also running locally, and am able to connect to that, so it's not an issue with the network. Is there any way to connect to localhost:8000 from within VMWare?

Update: To get this to work, I used the following settings:

  • In VMWare, set the network of the VM to "Connect directly to the physical network (Bridged)", rather than "Share this Mac's network connection (NAT)"
  • Find the IP address of the Mac itself on the network the Mac itself is on (not the private network VMWare sets up), e.g. 192.168.1.2. This can be found in ifconfig, or in System Preferences > Network
  • Start the Django development server on that IP address: sudo python manage.py runserver 192.168.1.2:80
  • In VMWare, connect to the Django site at 192.168.1.2

Thanks to randrumree for the answer below -- this is essentially the same solution.

like image 666
LS55321 Avatar asked Aug 31 '11 21:08

LS55321


2 Answers

  • In VMWare, set the network of the VM to "Connect directly to the physical network (Bridged)", rather than "Share this Mac's network connection (NAT)"
  • Find the IP address of the Mac itself on the network the Mac itself is on (not the private network VMWare sets up). This can be found using ifconfig, or in System Preferences > Network. Let's say it's 192.168.1.2.
  • Start the Django development server on that IP address: python manage.py runserver 192.168.1.2:8000
  • In VMWare, connect to the Django site at http://192.168.1.2:8000
like image 57
LS55321 Avatar answered Sep 18 '22 09:09

LS55321


Try:

python manage.py runserver 0.0.0.0:8000
like image 20
rczajka Avatar answered Sep 19 '22 09:09

rczajka