安装
Bobo 可以通过通常的方式安装,包括使用setup.py install 命令。当然,您可以使用Easy Install、Buildout或pip。
安装bobo
Collecting bobo
Downloading bobo-2.4.0.tar.gz (17 kB)
Collecting WebOb
Downloading WebOb-1.8.7-py2.py3-none-any.whl (114 kB)
|███████████████████████████████▌| 112 kB 731 kB/s eta 0:00:
|████████████████████████████████| 114 kB 731 kB/s
Collecting six
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Using legacy 'setup.py install' for bobo, since package 'wheel' is not installed.
Installing collected packages: WebOb, six, bobo
Running setup.py install for bobo ... done
Successfully installed WebOb-1.8.7 bobo-2.4.0 six-1.16.0
WARNING: You are using pip version 20.2.3; however, version 23.3.1 is available.
You should consider upgrading via the 'd:\pycharmprojects\demoproject\venv\scripts\python.exe -m
pip install --upgrade pip' command.
Hello world 浏览器
启动bobo -f bobo.py
import bobo
@bobo.query
def hello():
return "Hello world by keny!"
浏览器的html页面
添加query
@bobo.query('/')
def hello(name="world"):
return "Hello %s!" % name