2018年12月7日金曜日

開発環境

入門 Python 3 (Bill Lubanovic (著)、斎藤 康毅 (監修)、長尾 高弘 (翻訳)、オライリージャパン)の9章(ウェブを解きほぐす)、9.4(復習問題)9-1、2、3.を取り組んでみる。

コード(Emacs)

Python 3

#!/usr/bin/env python3
from flask import Flask

print('1, 2, 3.')

app = Flask(__name__)


@app.route('/')
def home():
    return "It's alive"


if __name__ == '__main__':
    app.run(debug=True)

入出力結果(Terminal, cmd(コマンドプロンプト), Jupyter(IPython))

$ python3 sample1.py
1, 2, 3.
 * Serving Flask app "sample1" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
1, 2, 3.
 * Debugger is active!
 * Debugger PIN: 178-619-558
127.0.0.1 - - [07/Dec/2018 13:24:26] "GET / HTTP/1.1" 404 -
127.0.0.1 - - [07/Dec/2018 13:24:26] "GET /favicon.ico HTTP/1.1" 404 -
 * Detected change in '... /sample1.py', reloading
 * Restarting with stat
1, 2, 3.
 * Debugger is active!
 * Debugger PIN: 178-619-558
127.0.0.1 - - [07/Dec/2018 13:24:53] "GET / HTTP/1.1" 200 -
  C-c C-c$ 

0 コメント:

コメントを投稿