LoginSignup
3
3

Render.comのStart Commandがわからなかった

Last updated at Posted at 2023-12-04

はじめに

Render.comでデプロイする際に、Build CommandとStart Commandが全く分からず困ったので、困った部分をメモします。
Render、Flaskともに初心者で、分からないなりに動かすために行ったことを記載しています。

前提

・Python3
・Flask

使い方

Build Command

requirements.txtに書いてあるライブラリをインストール(pip install)する

pip install -r requirements.txt

Start Command

app:appの1つ目のappは最初に起動するファイル名(app.pyのappの部分)、2つ目のappはコード内に書いた変数名を記載する。

app.py
app = Flask(__name__)
...
app.run()

(requirements.txtにGunicornを記載)

gunicorn app:app

補足

APIを使った関係でgunicornのタイムアウトエラーになったのですが、後ろに--timeout 120(任意の数字)をつけるとタイムアウトエラーを防げます。

gunicorn app:app --timeout 120
3
3
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
3
3