p上的游走性错误

2024-03-28 17:06:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这个流浪汉的档案。。。你知道吗

# -*- 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 one or two times the server_memory

server_timezone       = "UTC"
public_folder         = "/vagrant"

Vagrant.configure("2") do |config|

    # Set server to Ubuntu 14.04
    config.vm.box = "ubuntu/trusty64"

    config.vm.define "M101P" do |vapro|
    end

    # Create a hostname, don't forget to put it to the `hosts` file
    # This will point to the server's default virtual host
    # TO DO: Make this work with virtualhost along-side xip.io URL
    config.vm.hostname = hostname

    # Create a 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 do |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

本规定:

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

在运行了这个流浪机器之后,我有了这个测试瓶的代码

from bottle import route, run

@route('/')
@route('/hello/<name>')
def greet(name='Stranger'):
    return 'Hello %s, how are you?'%name

run(host='localhost', port=8000, debug=True)

但当我跑的时候…:

vagrant@m101p:/vagrant$ python test.py

Bottle v0.12.8 server starting up (using WSGIRefServer())...

Listening on http://localhost:8000/

Hit Ctrl-C to quit.

当我从web浏览器访问托盘时。。只有这个。。你知道吗

请有人能帮我。。。需要测试一下。。。你知道吗


Tags: tonameipgithubconfigurlbottleserver