2
1

More than 3 years have passed since last update.

(失敗)Flaskで作ったwebアプリをherokuでデプロイする

Posted at

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

ってやってみたけど、できなかった ><

2
1
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
2
1