This is my sample Python app structure. I have this app running under Kubernetes and have Procfile that detects and builds the app and deploys it. Reload works fine for Python files (.py) while static files like .html or .css files are not reloaded on change.
I can see the change files are copied into the container but Gunicorn doesn't restart the worker's thread when only static files are changed, while it restarts when copying the Python (.py) files. I have tried for a day now and am not sure where to look any help would help a ton.
.
├── Procfile
├── README.md
├── Tiltfile
├── board
│ ├── __init__.py
│ ├── pages.py
│ ├── postgresql.py
│ ├── posts.py
│ ├── schema-postgres.sql
│ ├── static
│ └── templates
├── gunicorn_config.py
├── requirements.txt
├── venv
│ ├── bin
│ ├── include
│ ├── lib
│ └── pyvenv.cfg
└── wsgi.py
gunicorn_config.py
workers = 1
loglevel = 'info'
reload = True
reload_extra_file = ['/workspace/board/templates/*.html', '/workspace/board/static/*.css']
errorlog = '-'
accesslog = '-'
threads = 2
worker_class = 'gthread'
wsgi.py
from board import create_app
app = create_app()
if __name__ == '__main__':
app.run()
Procfile
web: gunicorn -b :8080 wsgi:app --config gunicorn_config.py
All of the files are copied to /workspace folder in the container and as said above every change including the .html and .css change is reflected but the process doesn't reload/restart.
Thanks, folks for all the help. I got it running. Typical I had a typo in the config its
reload_extra_filesand notreload_extra_file. Some of these values are different when used in the command line vs. in a python file.gunicorn_config.py (working)