how to access django development server on virtual machine from actual computer - django

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?

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.

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.

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

Related

How to put esxi host into maintance mode while it have the VCSA VM on it

I have a standalone VM Host running Esxi 6.7 with 9 VMs host running on it. between these 8 VMs there is VCSA Machine that requires me to put host into maintance mode.
i can't shutdown the VCSA to put the host in maintaince mode (i can do it from the Esxi web interface but then i lose the control from VCSA which i need to run the updates)
There is no way to put the host in maintenance mode while a VM is running.
The host is in a state of Entering Maintenance Mode until all running virtual machines are powered down or migrated to different hosts
https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.vsphere.resmgmt.doc/GUID-8F705E83-6788-42D4-93DF-63A2B892367F.html

How to access django development server on VM virtual box from actual computer?

Virtual box settingimageI have my actual laptop which has virtual box installed. I am running Ubuntu 18.04 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
I added ip address of host computer on allowed hosts on settings.py file but still its now working. If I did manage.py runserver 192.0.2.15:8000 on vm where 192.0.2.15 is ip address of vm, it gives error that ip address can't be assigned to.
Any idea how to fix it?

Access VM Django Dev Server from Hyper-V VM Host Physical Machine

I am currently using Hyper-V to create a ubuntu 18.04.1 Desktop VM. On this VM I am creating a Django Dev Server using the following:
python manage.py runserver 0.0.0.0:8000
When I go to the 0.0.0.0:8000 on the vm I am presented with the Django debug page. However, when I to the url on my desktop I Unable to connect screen.
When I run the server with an IP of anything other than 0.0.0.0 or 127.0.0.1, I just Error: That IP address cab't be assigned to.
My Hyper-V Virtual Switch is an external network with my physical machines network adapter.
I am using Python 3.6.5, and Django 2.1
How do I access the Django Development Server on my VM hosts machine browser.

Local Server not loading in Ubuntu VirtualBox

I have laravel app which is running in my windows local server. This laravel app is running port:80. I want to load this app in my Ubuntu VirtualBox.
My IP Config:
IPv4 Address : 192.168.8.157
Subnet Mask : 255.255.255.0
Default Gateway: 192.168.8.1
I have config my virtualbox as Bridged Adapter. In my /etc/hosts (ubuntu virtualbox), I have this :
127.0.0.1 localhost
127.0.1.1 asus
192.168.8.157 v2.my.local
I have made a hello word app (node.js) in my local windows which is running on port :3000, and it is running in my VirtualBox by typing v2.my.local:3000, but if I type v2.my.local on my VirtualBox, it is not working (although app is running on windows local machine). it says:
This v2.my.local page can’t be found
Any suggestion? Thanks in Advance.
May be windows firewall blocking connections via port 80. turn off firewall and try it, if it works. Start windows firewall and add firewall rule to allow connections via port 80. If your windows version is 10 then, it will block all virtual box related connections. make sure to add correct rules.

Vagrant + Virtual Box - Virtual host not accessible

I have a Vagrant set up on my machine which uses Virtual Box. When I start Vagrant and ssh into it, the Virtual Box VM starts up. I can ping the server. But I cannot access the url I set in the hosts file via my browser. I've removed the browser's proxy as well.
Any step that I need to do to get it running?
Note: I'm on Windows 7, using Vagrant 1.5.1 and VirtualBox 4.3.8.
If you can ping the server on the IP and port that you've setup your webserver, very likely the issue is with your webserver's config and how it responds to external IPs
As an example, installing Apache on the precise image requires you to 'listen all'