開発環境
- macOS Sierra - Apple (OS)
- Emacs (Text Editor)
- Python 3.6 (プログラミング言語)
Head First Python (Paul Barry (著)、O'Reilly Media)のChapter 10.(Function Decorators: Wrapping Functions) の SHARPEN YOUR PENCIL(No. 6992) を取り組んでみる。
SHARPEN YOUR PENCIL(No. 6992)
コード(Emacs)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from flask import Flask, session app = Flask(__name__) app.secret_key = 'YouWillNeverGuess' @app.route('/login') def do_login() -> str: session['logged_in'] = True return 'You are now logged in' if __name__ == '__main__': app.run(debug=True)
入出力結果(Terminal, IPython)
$ ./sample1.py * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger PIN: 873-014-066 127.0.0.1 - - [07/Apr/2017 13:09:18] "GET /login HTTP/1.1" 200 - C-c C-c$
0 コメント:
コメントを投稿