How to access running python in vagrant from host machine browser? -


i installed vagrant in windows, have virtual ubuntu , run python script :

vagrant@precise32:/vagrant/flaskmysql/flaskapp$ ls app.py  static  storedpro.txt  templates vagrant@precise32:/vagrant/flaskmysql/flaskapp$ python app.py * running on http://127.0.0.1:5002/ (press ctrl+c quit) 

my vagrantefile :

config.vm.box = "hashicorp/precise32"   config.vm.provision :shell, path: "bootstrap.sh"   config.vm.network :forwarded_port, guest: 80, host: 4567   config.vm.network :forwarded_port, guest: 5002, host: 5002 

i tried access above address browser in window, index.html page appears in couple of seconds disappears.

update :

vagrant@precise32:/vagrant/flaskmysql/flaskapp$ curl http://127.0.0.1:5000 <!doctype html public "-//w3c//dtd html 3.2 final//en"> <title>500 internal server error</title> <h1>internal server error</h1> <p>the server encountered internal error , unable complete   request.  either server overloaded or there error in application.</p> 

thanks.

in addition forwarding port you'll need run flask app host "0.0.0.0":

app.run(host='0.0.0.0', port=5002) 

this makes dev server externally visible; in case of vagrant, want app externally visible (from guest os host os).


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -