gorgeous-eve-12553
08/01/2020, 7:11 PMgunicorn main:app
(Pants 2.0)happy-kitchen-89482
08/03/2020, 4:37 AMminiature-lamp-45970
08/04/2020, 10:41 PMhappy-kitchen-89482
08/04/2020, 11:32 PMpython_binary(
name = 'foo-gunicorn',
entry_point = foo.gunicorn_main',
zip_safe=False,
dependencies = [...],
)
And foo/gunicorn_main.py
is a wrapper around the gunicorn entry point that sets up Django and injects the gunicorn config.gunicorn.app.wsgiapp.WSGIApplication.run()
WSGIApplication
and implement load_config()
to call self.load_config_from_file(conf_path)
where conf_path
points to the config for specific app we're running.miniature-lamp-45970
08/05/2020, 12:09 AMhappy-kitchen-89482
08/05/2020, 2:13 AMif __name__ == "__main__":
CustomGunicornService.from_file_name(__file__).run_gunicorn()
from_file_name()
uses that arg to figure out who ran it, and construct an appropriate reference to a config file.