herokuデプロイ。

【Python/Flask】作成したアプリをHerokuで公開する方法(Windows、Mac編)

 

herokuを使ってPythonのflaskで作ったアプリケーションをデプロイする方法と注意点!|スタビジ

 

 

 

 上記二つを見れば何とかなる。

 

ログインする際は

 

heroku login --interactive

 

を実行あとパスワードはapiキーを入力。

Heroku

 

アプリ名は小文字を使う。

 

 

 

今回と前回のruntime.txt

 

python-3.11.0

 

requirements.txtは

 

Flask==2.2.3
Flask-Login==0.6.2
Flask-Mail==0.9.1
Flask-SQLAlchemy==3.0.3
Jinja2==3.1.2
MarkupSafe==2.1.2
PyTweening==1.0.4
SQLAlchemy==2.0.9
Werkzeug==2.2.3
blinker==1.6.2
click==8.1.3
greenlet==2.0.2
itsdangerous==2.1.2
pygetwindow==0.0.9
pymsgbox==1.0.9
pyperclip==1.8.2
pyrect==0.2.0
pyscreeze==0.1.28
python3-Xlib==0.15
typing-extensions==4.5.0
waitress==2.1.2
gunicorn==20.1.0
PyJWT==2.6.0
PyMySQL==1.0.2
email-validator==1.3.1

 

初コミットする際は

 

メールとユーザー名を登録。

 

 

初プッシュする際は

 

git remote add heroku https://git.heroku.com/roboses-g2023418.git

 

太文字の後ろはアプリごとにかわる。

 

デプロイする際は

app.run(debug=True,host='0.0.0.0', port=5000)

 

debug=True,

 

を削除

 

これでプッシュしてデプロイできる

 

git push heroku master

 

 

独自ドメインのやり方は下記を参照しろ。

 

koleoblog.info

 

www.onamae.com

 

 

 

 

変更を再デプロイする際は

 

git add .
git commit -m "Fix Testdbs model and form"
git push heroku master

 

 

 

dbの設定はこちら

qiita.com