This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
author | book | |
---|---|---|
J R R Tolkien | The Hobbit | |
Lynne Truss | Eats, Shoots & Leaves |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import route, run | |
@route('/') | |
def home(): | |
return "It isn't fancy, but it's my home page" | |
run(host='localhost', port=9999) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import route, run, static_file | |
@route('/') | |
def main(): | |
return static_file('index.html', root='.') | |
run(host='localhost', port=9999) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import route, run, static_file | |
@route('/') | |
def main(): | |
return static_file('index.html', root='.') | |
@route('/echo/<thing>') | |
def echo(thing): | |
return "Say hello to my littel friend: %s" % thing | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
resp = requests.get('http://localhost:9999/echo/Mothra') | |
if resp.status_code == 200 and \ | |
resp.text == 'Say hello to my little friend: Mothra': | |
print('It worked! That almost never happens!') | |
else: | |
print('Argh, got this:', resp.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__, static_folder='.', static_url_path='') | |
@app.route('/') | |
def home(): | |
return app.send_static_file('index.html') | |
@app.route('/echo/<thing>') | |
def echo(thing): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Flask2 Example</title> | |
</head> | |
<body> | |
Say hello to my little friend: {{ thing }} | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Flask3 Example</title> | |
</head> | |
<body> | |
Say hello to my little friend: {{ thing }}. | |
Alas, in just destroyed {{ place }}! | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, request | |
app = Flask(__name__, static_folder='.', static_url_path='') | |
@app.route('/') | |
def home(): | |
return app.send_static_file('index.html') | |
@app.route('/echo/') | |
def echo(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, request | |
app = Flask(__name__, static_folder='.', static_url_path='') | |
@app.route('/') | |
def home(): | |
return app.send_static_file('index.html') | |
@app.route('/echo/') | |
def echo(): |
OlderNewer