Skip to content

Commit b0034b2

Browse files
authored
Enable automatic gunicorn reloading in development (#247)
This saves having to manually restart gunicorn after making changes to the app in development when using `heroku local`. See: https://docs.gunicorn.org/en/stable/settings.html#reload GUS-W-17614098.
1 parent d580c39 commit b0034b2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
# running on Heroku - to set env vars for those, see:
44
# https://devcenter.heroku.com/articles/config-vars
55

6+
# This is used in gunicorn.conf.py to set appropriate settings for development vs production.
7+
ENVIRONMENT="development"
8+
9+
# An example env var used in the tutorial.
610
TIMES=2

gunicorn.conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@
5858
# style. The `X-Request-Id` and `X-Forwarded-For` headers are set by the Heroku Router:
5959
# https://devcenter.heroku.com/articles/http-routing#heroku-headers
6060
access_log_format = 'gunicorn method=%(m)s path="%(U)s" status=%(s)s duration=%(M)sms request_id=%({x-request-id}i)s fwd="%({x-forwarded-for}i)s" user_agent="%(a)s"'
61+
62+
if os.environ.get("ENVIRONMENT") == "development":
63+
# Automatically restart gunicorn when the app source changes in development.
64+
reload = True

0 commit comments

Comments
 (0)