I have a Django web server on a VirtualBox/Vagrant machine running "bento/centos-6.7-i386". I have followed this guide to create a Django project: https://docs.djangoproject.com/en/dev/intro/tutorial01/
I have a web server running at http://127.0.0.1:8000/ inside my guest machine. This is the first time I am running a Django web server. It is supposed to be a hello world app.
How can I access this web application from my host browser?
I tried adding this line - config.vm.network "private_network", ip: "55.55.55.5"
in the vagrant file and then tried to run the python manage.py runserver 0.0.0.0:80
command as per 1 of the solutions explained in previous discussions by others but I couldn't access the site from my host browser using 55.55.55.5:8000.
How can I access the web server from my browser?
Following given is my Vagrant File:
# -- mode: ruby --
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-6.7-i386"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 5000, host: 5000
config.vm.network "private_network", ip: "10.10.10.10"
end
python manage.py runserver 0.0.0.0:8000
and access port 8000 of your host machine. – Klaus D.python manage.py runserver 0.0.0.0:80
make sure to add a lineconfig.vm.network "forwarded_port", guest: 80, host: 8800
so you forward the port 80 from your VM (where you have the server running) to the host port 8800 so you can access localhost:8800 from your host web browser (sometime you need to change localhost to 127.0.0.1 depending browser and configuration) – Frederic Henri