2

I'm working in a project that uses vagrant to create environments, which is new to me (I'm loving it). In my vagrantfile i have these forwards:

dev.vm.network "forwarded_port", guest: 80, host: 8000
dev.vm.network "forwarded_port", guest: 8080, host: 8080
dev.vm.network "forwarded_port", guest: 8000, host: 8001
dev.vm.network "forwarded_port", guest: 3306, host: 3307
dev.vm.network "forwarded_port", guest: 6379, host: 6380
dev.vm.network "forwarded_port", guest: 9200, host: 9201
dev.vm.network "forwarded_port", guest: 5555, host: 5556

And then I start the django dev server using python manage.py runserver. It looks like the server is running OK, I get this message:

Django version 1.8.7, using settings 'config.settings.development'
Starting development server at http://127.0.0.1:8000/

And when I try to access the url above I receive a "Welcome to nginx!" page. Which is not the django project homepage.

I'm a bit confused. The forward seems OK and I don't understand yet why I'm getting the nginx page.

Thanks in advance for any help

1
  • Also instead of messing with port forwarding you can just specify config.vm.network "private_network", ip: "192.168.33.10" and work with that IP like if it was a normal remote server. Commented Apr 17, 2016 at 23:18

1 Answer 1

3

You're forwarding port 80 on the Vagrant VM to port 8000 on your host machine, so you will see nginx at the URL with port 8000.

Port 8000 is forwarded to 8001 on your host machine, so you need to visit:

http://127.0.0.1:8001/

Give that URL a try in your browser.

Update: try this command:

python manage.py runserver 0.0.0.0:8000

Then try the URL above, or:

http://localhost:8001/

Good luck!

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your answer! Unfortunately this Url didn't work either. I don't know if this info is relevant, but I'm using Mac OS Yosemite
After your ammend it worked! Thanks for taking some of your sunday time to help me. Have a great day!
My pleasure! Vagrant is a great tool. If you want some ideas on other things you can do, I've got a public one I toy with here: github.com/FlipperPA/django-python3-vagrant

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.