python - Vagrant and bottlepy error on port -
i have vagrant file...
# -*- mode: ruby -*- # vi: set ft=ruby : # config github settings github_username = "fideloper" github_repo = "vaprobash" github_branch = "1.4.0" github_url = "https://raw.githubusercontent.com/# {github_username}/#{github_repo}/#{github_branch}" # server configuration hostname = "m101p" server_ip = "192.168.0.127" server_cpus = "1" # cores server_memory = "384" # mb server_swap = "768" # options: false | int (mb) - guideline: between 1 or 2 times server_memory server_timezone = "utc" public_folder = "/vagrant" vagrant.configure("2") |config| # set server ubuntu 14.04 config.vm.box = "ubuntu/trusty64" config.vm.define "m101p" |vapro| end # create hostname, don't forget put `hosts` file # point server's default virtual host # do: make work virtualhost along-side xip.io url config.vm.hostname = hostname # create static ip config.vm.network :public_network, ip: server_ip config.vm.network :forwarded_port, guest: 8000, host: 8001 config.ssh.forward_agent = true config.vm.synced_folder ".", "/vagrant" config.vm.provider :virtualbox |vb| vb.name = "m101p" vb.customize ["modifyvm", :id, "--cpus", server_cpus] vb.customize ["modifyvm", :id, "--memory", server_memory] vb.customize ["guestproperty", "set", :id, "/virtualbox/guestadd/vboxservice/--timesync-set-threshold", 10000] end #### # base items ########## # provision base packages config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap, server_timezone] # optimize base box config.vm.provision "shell", path: "#{github_url}/scripts/base_box_optimizations.sh", privileged: true # provision bottle framework config.vm.provision "shell", path: "./bottlepy.sh" enter code here end
this provision:
bottlepy.sh
#!/usr/bin/env bash echo ">>> python-bottle" echo ">>> requierements python-bottle" apt-get install -qq build-essential python python-dev python-setuptools python-pip echo ">>> install python-bottle" pip install bottle
after run vagrant machine, have code test bottle
from bottle import route, run @route('/') @route('/hello/<name>') def greet(name='stranger'): return 'hello %s, how you?'%name run(host='localhost', port=8000, debug=true)
but when run...:
vagrant@m101p:/vagrant$ python test.py
bottle v0.12.8 server starting (using wsgirefserver())...
listening on http://localhost:8000/
hit ctrl-c quit.
when tray access web browser.. this..
pls me... need test this...
Comments
Post a Comment