Access Django project in a virtual machine bridge mode

You first need to ensure that the host and virtual machines can Ping through each other, if Ping fails, please refer to my previous article, demonstrated here is the method in bridge mode, if the connection is NAT mode, please refer elsewhere.

 

Django project settings.py file within the virtual machine 1. Linux system, the modified ALLOWED_HOSTS = [ '*']

 

2. Turn off the virtual machine firewall

#systemctl status firewalld

#yum install firewalld // firewall installed firewalld

#systemctl start firewalld.service // open the firewall

# Systemctl stop firewalld.service // turn off the firewall, (turn off the firewall, restart invalid)

# Systemctl enable firewalld.service // settings at startup

# Systemctl disable firewalld.service // set the brake-power-off (turning off the firewall, permanent)

# Firewall-cmd --reload // without changing the state of conditions reload firewall

 

3. Virtual machines running python manage.py runserver 0.0.0.0:8000

 

4. Host Access  http://192.168.10.142:8000/admin  (where IP is the IP of your virtual machine)

Guess you like

Origin www.cnblogs.com/WalkOnMars/p/11994570.html