LoginSignup
9
8

More than 5 years have passed since last update.

GAE/PythonでBottleフレームワークを使った時のエラーログ出力方法

Posted at

超ド基礎な部分ですが、ローカルでサンプルを起動した時に、ブラウザで「Error: 500 Internal Server Error、以上!」となりコンソールにもエラーログが表示されず困った君になってしまったのでメモを残しておきます。

main.py

# -*- coding: utf-8 -*-
import logging

# ↓debugをインポート
from bottle import Bottle, debug

bottle = Bottle()

# ↓デバッグモードON!
debug(True)

@bottle.route('/')
def home():
  return 'はろー'

@bottle.error(404)
def error_404(error):
  return 'Sorry, Nothing at this URL.'

とりあえずdebug(True)を打っておけばServerError時に詳細なエラーログが表示されます。たったこれだけのことなのですが、python初心者にはわかんなかったんですよ、はい・・・。

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8