週末副業記

土日は副業エンジニアのブログです。副業に関することを投稿します。

flask使用の際に使用したコマンドライン入力【Python×Flask】


f:id:aisakakun:20180725225838j:plain

コマンドラインなど、私が入力したものをほとんどそのまま載せます。
環境

Mac High Sierra
・Python3 (pip3)
・gitあり
・virtualenv改め、venvあり

参考サイト:
1. Webアプリケーションを作る準備 — study flask 1 ドキュメント

$mkdir flask_test
$cd flask_test
$git clone https://github.com/planset/study_flask
$mkdir handson
$cd handson
$ python3 -m venv myvenv
$source env/bin/activate
[env] handson $pip3 install flask
[env] handson $mkdir hello world
[env] handson $cd hello world
[env] handson helloworld$vim app.py
[env] handson helloworld$python3 app.py
http://127.0.0.1:5000/にアクセス


[env] handson helloworld$cd ..
[env] handson$mkdir -p tutorial/flaskr/{static,templates}

[env] handson$cd tutorial/
[env]  tutorial$touch manage.py requirements.txt
[env]  tutorial$touch manage.py requirements.txt
[env]  tutorial$touch flaskr/{__init__,views,models,config}.py
[env]  tutorial$touch flaskr/static/style.css
[env]  tutorial$touch flaskr/templates/{layout,show_entries}.html
[env] tutorial$vim requirements.txt
[env]  tutorial$pip3 install -r requirements.txt


[env] tutorial$cd flaskr/
[env] flaskr$vim config.py
[env] flaskr$cd ..
[env] tutorial$

2. Flaskチュートリアル — study flask 1 ドキュメント

Flask Web Development: Developing Web Applications with Python

Flask Web Development: Developing Web Applications with Python

  • 作者:Miguel Grinberg
  • 出版社/メーカー: O'Reilly Media
  • 発売日: 2018/03/25
  • メディア: ペーパーバック