Running gunicorn on https?

Gunicorn now supports SSL, as of version 17.0. You can configure it to listen on https like this: $ gunicorn –certfile=server.crt –keyfile=server.key test:app If you were using –bind to listen on port 80, remember to change the port to 443 (the default port for HTTPS connections). For example: $ gunicorn –certfile=server.crt –keyfile=server.key –bind 0.0.0.0:443 test:app

A better way to restart/reload Gunicorn (via Upstart) after ‘git pull’ing my Django projects

You can tell Gunicorn to reload gracefully using the HUP signal like so: kill -HUP <pid> (see the FAQ for details) I use Supervisor to control my Gunicorn server, which allows me to use this (slightly hacky) way of reloading Gunicorn after a deploy: supervisorctl status gunicorn | sed “s/.*[pid ]\([0-9]\+\)\,.*/\1/” | xargs kill -HUP … Read more

Why is Flask application not creating any logs when hosted by Gunicorn?

This approach works for me: Import the Python logging module and add gunicorn’s error handlers to it. Then your logger will log into the gunicorn error log file: import logging app = Flask(__name__) gunicorn_error_logger = logging.getLogger(‘gunicorn.error’) app.logger.handlers.extend(gunicorn_error_logger.handlers) app.logger.setLevel(logging.DEBUG) app.logger.debug(‘this will show in the log’) My Gunicorn startup script is configured to output log entries to … Read more

Debugging a Flask app running in Gunicorn

The accepted solution doesn’t work for me. Gunicorn is a pre-forking environment and apparently the Flask debugger doesn’t work in a forking environment. Attention Even though the interactive debugger does not work in forking environments (which makes it nearly impossible to use on production servers) […] Even if you set app.debug = True, you will … Read more

Docker/Kubernetes + Gunicorn/Celery – Multiple Workers vs Replicas?

These technologies aren’t as similar as they initially seem. They address different portions of the application stack and are actually complementary. Gunicorn is for scaling web request concurrency, while celery should be thought of as a worker queue. We’ll get to kubernetes soon. Gunicorn Web request concurrency is primarily limited by network I/O or “I/O … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)