# heroku ### 建立heroku應用 ``` heroku create heroku (app名稱) ``` ### git init 第一次git會出現這個 ,再推一次git就行了 ![](https://i.imgur.com/uNZud5E.png) #### 第二次 git init ![](https://i.imgur.com/QZ2WgKz.png) ### 如果git push heroku master 出現這個錯誤的話代表你的python版本跟heroku支援的不相容,修改runtime.txt 裡面的python版本 ![](https://i.imgur.com/YsUejAW.png) ### heroku branch change ``` heroku git:remote -a [app名子] ``` ### python版本查詢 ``` python -- version ``` 用git push檔案到 heroku上 流程 * git init * git add . * git push heroku master ### 最後看到 Verifying deploy... done.就是push成功 ![](https://i.imgur.com/SbNAOJY.png) ### 如果再次git後發現 ![](https://i.imgur.com/9NK0XGw.png) 代表目前檔案沒有做變動 ### Deploy your changes(heroku) ``` $ git add . $ git commit -am "make it better" $ git push heroku master ``` ---------- 資料庫Heroku Postgres----------------- 創建資料庫Heroku Postgres ``` heroku addons:create heroku-postgresql:選擇方案 免費版的話是hobby-dev heroku addons:create heroku-postgresql:hobby-dev ``` 查詢有沒有建立成功 ``` heroku addons -a app名子 ``` ![](https://i.imgur.com/KljVuM0.png) --- ## 錯誤尋找 ``` heroku logs --tail --app {HEROKU_APP_NAME} ``` ## error: src refspec master does not match any.解決方法 ![](https://i.imgur.com/9dpf5ms.png) ``` git init git add . git commit -m "init" ``` [鐵人](https://ithelp.ithome.com.tw/articles/10217350) [LINE BOT SDK:Heroku Postgres 資料庫](https://ithelp.ithome.com.tw/articles/10219773) ###### tags: `linebot筆記`