Reputation:
i want install Django in my VM created with PuPHPpet (Vagrant), then when i start the server with
python manage.py runserver
My project is normally available in 127.0.0.1:8000 But i have unreachable web page, then i try
python manage.py runserver ipvm:8000 and others ports
I have always unreachable web page So, i have found in this forum
0.0.0.0:8000
And i have again unreachable web page, Why ? How can start my server in my VM ?
Upvotes: 3
Views: 3130
Reputation: 393
You have to forward the port from Vagrant to your local machine.
config.vm.network :forwarded_port, host: 8001, guest: 8000
Yo need to add IP to ALLOWED_HOST in your setting.py file
0.0.0.0 to the ALLOWED_HOSTS in your settings.py
Run Project
python manage.py runserver 0.0.0.0:8000
Upvotes: 0
Reputation: 410562
You have to forward the port from Vagrant to your local machine. You can add a line like this to your Vagrantfile:
config.vm.network :forwarded_port, host: 8001, guest: 8000
And then run this in the Vagrant VM:
python manage.py runserver 0.0.0.0:8000
And on your host machine, go to http://localhost:8001 to view the webpage.
Upvotes: 11