以下の内容はhttps://shuzo-kino.hateblo.jp/entry/2016/09/07/233045より取得しました。


bottleでダウンロードリンクをつくる

今回の記事はbottleでダウンロードさせる方法についてです。
ローカルで生成した結果を読み込ませたり、webページに載せるにはちょっと分量が多くなりすぎる内容を掲載できますね。

実際のところ

imageディレクトリにgopherくんの画像"gopher.png"を用意しておきます。

スクリプト

最小限だとこんな感じ。
download用のライブラリは不要みたいです。

from bottle import run, static_file
from time import strftime

@get('/download/<filename:re:.*.png>')
def download(filename):
    return static_file(filename, root='/Users/shuzo_kino/python/image', download=filename)

run(host='localhost', port=8080)



以上の内容はhttps://shuzo-kino.hateblo.jp/entry/2016/09/07/233045より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14