Flaskのアプリをherokuとgithubを使ってデプロイしてみます。
メモのために書きます。と思ってやってたんですが、デプロイしたページを見ようとするとエラーが出てします。前はできたんだけど、、、
まずプログラムを入れるファイルを作ります。
(base) PS C:\working\web_app> python -m venv 新しく作るファイル名(今回はmessage_app)
仮想環境を設定する。
下のコマンドを打つと仮想環境が稼働します。
(base) PS C:\working\web_app\message_app>Scripts\activate
次にライブラリを仮想環境にインストールします。
(message_app) PS C:\working\web_app\message_app>pip install 使うライブラリ名(今回はflaskとrequestとgunicorn)
pip install -r requirements.txt(requirements.txtを使ってインストールもできる)
Procfileという名前のファイルを作るってエディタでファイルに以下の文を書いておく
web: gunicorn app:app --log-file=-
requirements.txtを作って中にしたのコマンドで出てきたインストールされてるライブラリの情報をコピペする
pip freeze
以下のコマンドを実行する
git init
git add .
addと.の間に半角スペースがあるのに注意
git commit -m “コメント”
heroku login
heroku create
git push heroku master
ってやってみたけど、できなかった ><