pip install bottle
python
from bottle import Bottle
app = Bottle()
python
@app.route('/')
def hello():
return 'Hello World!'
python
if __name__ == '__main__':
app.run()
html
<!DOCTYPE html>
<html>
<head>
<title>Bottle Tutorial</title>
<link rel="stylesheet" type="text/css" href="/static/style.css">
</head>
<body>
<h1>Welcome to Bottle Tutorial</h1>
<p>This is a sample template!</p>
</body>
</html>
python
from bottle import static_file, template
@app.route('/')
def hello():
return template('index')
@app.route('/static/<filename:path>')
def serve_static(filename):
return static_file(filename, root='./views')