LoginSignup
28
30

More than 5 years have passed since last update.

macでheroku deploy

Last updated at Posted at 2019-02-13

herokuでflaskアプリをデプロイする作法のメモ

herokuをインストール

以下でheroku toolbelt をインストール
Download and run the OS X installer.
https://devcenter.heroku.com/articles/heroku-command-line

今回はターミナルで落とす

$brew tap heroku/brew && brew install heroku

インストールできたら

$heroku login

ブラウザが立ち上がりログインが求められる

デプロイしたいフォルダに移動して

設定用のファイルを作成する
requirements.txtにはインストールしたいライブラリが
記述されるが、これが無駄に多かったり、versionに問題が
あると後のpushで失敗する。

$pip freeze > requirements.txt
$echo python-3.6.3 > runtime.txt
$echo web: gunicorn アプリ名:app --log-file=- > Procfile
$heroku create 
$heroku buildpacks:set heroku/python
$git add -A
$git commit -m "first deploy"
$git push heroku master

ソフトやライブラリーのダウンロードが始まればオーケー

$heroku ps:scale web=1
$heroku open
28
30
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
30