如何从实际的计算机访问虚拟机上的django开发服务器 [英] how to access django development server on virtual machine from actual computer
问题描述
我能够得到@Kerberos的答案。 (没有足够的评论点,所以我把它添加为一个单独的答案)。
我在VMWare的客户操作系统中运行Ubuntu 12.04 LTS。主机笔记本电脑正在运行Windows 8。
如Kerberos所述,在VMWare中,转到 Player ==>管理==>虚拟机设置...
在硬件选项卡上,选择网络适配器
然后选择 Bridged的单选按钮:直接连接到物理网络
。选择确定
在虚拟机中,网络连接信息现在应该具有主机操作系统互联网的相同IP地址连接。在我的情况下:192.168.1.141(你的不同)。
在虚拟机中,使用 python manage runserver启动Django 192.168.1.141:8000
使用此方法,我可以从虚拟机访问虚拟机中的VM服务器,从主机和来自同一个192.168.1.xxx网络上的其他系统。
Okay so I have my actual laptop which has vmware player installed. I am running lubuntu as a virtual machine and I installed django on the virtual machine and am testing my app so I did python manage.py runserver and I can access the app by visiting 127.0.0.1:8000 from my VM, however, If I go to 127.0.0.1:8000 from the actual computer (not the VM), it says 'chrome could not connect to 127.0.0.1:8000'.. Any idea how to fix it?
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.
这篇关于如何从实际的计算机访问虚拟机上的django开发服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!