如何在VMWare中看到Django开发服务器? [英] How can I see the Django development server in VMWare?

查看:119
本文介绍了如何在VMWare中看到Django开发服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到从运行Windows的VMWare运行在OS X localhost:8000中的Django开发服务器。



我已经尝试过各种设置组合,但没有一个似乎不起作用:




  • 在localhost:8000和Windows中运行Django服务器,连接到通过VMWare分配给Mac的IP地址,即192.168.XX.XX:8000

  • 运行端口80上的Django服务器

  • 在VMWare分配的Mac的IP上运行Django服务器,例如python manage.py runserver 192.168.XX.XX:8000



这些似乎都不行。我有一个Apache服务器也在本地运行,并且能够连接到它,所以这不是网络的问题。有没有办法从VMWare中连接到localhost:8000?



更新:要使其正常工作,我使用以下设置:




  • 在VMWare中,将虚拟机的网络设置为直接连接到物理网络(Bridged),而不是共享此Mac网络连接(NAT)

  • 在Mac自身所在的网络(不是VMWare的专用网络)上查找Mac本身的IP地址,例如192.168.1.2。这可以在ifconfig或System Preferences> Network中找到

  • 在该IP地址上启动Django开发服务器:sudo python manage.py runserver 192.168.1.2:80

  • 在VMWare中,连接到Django站点192.168.1.2



感谢randrumree的下面的答案 - 这是基本相同的解决方案。

解决方案


  • 在VMWare中,将虚拟机的网络设置为直接连接到
    物理网络(Bridged),而不是共享此Mac的网络
    连接(NAT)

  • 查找Mac本身的IP地址在Mac本身的
    网络上(不是私有网络VMWare设置
    up)。这可以使用 ifconfig 或System
    首选项>网络找到。假设这是 192.168.1.2

  • 在该IP
    地址上启动Django开发服务器: python manage.py runserver 192.168.1.2:8000

  • 在VMWare中,连接到Django站点 http://192.168.1.2:8000


    • 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.

      解决方案

      • 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

      这篇关于如何在VMWare中看到Django开发服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆