Flaskよりも簡単にweb開発ができるらしいStreamlitをいじってみた。
HTMLやCSS,、JavascriptなしでWEBサイトができるなんて新鮮。
~>mkdir StreamLit
~\StreamLit>python -m venv myvenv
~\StreamLit\myvenv\Scripts>activate
~\StreamLit\myvenv\Scripts>pip install streamlit
仮想環境構築久しぶりで、ちょっと手間取る。
無事インストールが済んでからvscodeでファイルを開く。
~\StreamLit\myvenv\Scripts> code .
app.pyを作成、streamlitをインポートして、タイトルをつけてみる。
![](https://goohayami.com/wp-content/uploads/2023/03/st_01.png)
デスクトップ\StreamLit\myvenv\Scripts> streamlit run app.py
run app.pyで実行すると
![](https://goohayami.com/wp-content/uploads/2023/03/st_02-1024x388.png)
ヘッダーとテキストを追加してみる。
![](https://goohayami.com/wp-content/uploads/2023/03/st_03-1024x233.png)
![](https://goohayami.com/wp-content/uploads/2023/03/st_04-1024x482.png)
では、まずデプロイをしてみます。
Streamlitにサインアップ。
Githubにリポジトリを作成して、データをプッシュしてから
![](https://goohayami.com/wp-content/uploads/2023/03/st_05-1-1024x382.png)
Githubと連携する。
![](https://goohayami.com/wp-content/uploads/2023/03/st_07.png)
色々質問に答えてから
![](https://goohayami.com/wp-content/uploads/2023/03/st_08.png)
デプロイしたいリポジトリ名とブランチ(mainのまま)、Pathはapp.pyに変更してDeployを実行。
![](https://goohayami.com/wp-content/uploads/2023/03/st_10-1024x707.png)
![](https://goohayami.com/wp-content/uploads/2023/03/st_11.png)
しばらく待つと・・・無事デプロイが出来ました!
![](https://goohayami.com/wp-content/uploads/2023/03/st_12-1024x521.png)
はじめてのStreamlit 今回作成したWebサイト