Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created July 9, 2016 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/de0788fc359ac7c78255e000c498b94e to your computer and use it in GitHub Desktop.
Save kurozumi/de0788fc359ac7c78255e000c498b94e to your computer and use it in GitHub Desktop.
【Python】Bottleで404 Not Foundページをカスタマイズする
from bottle import route, run, template, error
import os
@error(404)
def error404(error):
return template("<h1>{{error_message}}</h1>", error_message="404 Not Found.")
run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment