Windows での Python 3.10 のインストール,pip と setuptools の更新: 別ページ »で説明している.
Python の公式ページ: https://www.python.org/
※ 以下、Windowsでの手順で説明する.Ubuntu等でも同様の手順になる.
Python パッケージをインストールする
python -c "import flask; print( flask.__version__ )"
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' if __name__ == '__main__': app.run(debug=False, host="0.0.0.0", port=5000)
Python プログラムの実行
Python 開発環境(Jupyter Qt Console, Jupyter ノートブック (Jupyter Notebook), Jupyter Lab, Nteract, Spyder, PyCharm, PyScripterなど)も便利である.
Python のまとめ: 別ページ »にまとめ
from flask import Flask app = Flask(__name__) @app.route('/') def root(): return 'root' @app.route('/hello') def hello(): return 'hello' @app.route('/user/<username>') def user(username): return 'user %s' % username if __name__ == "__main__": app.run(debug=False, host="0.0.0.0", port=5000)