I have a Django web server on a VirtualBox/Vagrant machine running Ubuntu.
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 have tried running ifconfig in the guest to get the IP that I should visit I found a promising IP address in inet addr.
But I have tried entering the following into my host browser and it didn't work.
http://inetaddrnumbers:8000/
How can I access the web server from my browser?
Try this.
config.vm.network
. If you didn't set up the file earlier, it should be commented-out.config.vm.network "private_network", ip: "55.55.55.5"
. Here the IP address (55.55.55.5) can be any IP address you want.vagrant reload
.python manage.py runserver 0.0.0.0:80
. Again, the port address (80) can be 8000 if you want it so.55.55.55.5
, and hopefully you should see your web app.Now if you would like to go further, you can edit your host file, and add this line:
55.55.55.5 mynewdomain.com
Then, in your browser, enter the following address:
mynewdomain.com
And you should see your web app. Note that www is not added in the domain name inside the host file, so only mynewdomain.com can be accessed by hostname. You can, however, add it.
55.55.55.5 mynewdomain.com www.mynewdomain.com
Hope this helps. Cheers