python-gallery/setup/runner.py

36 lines
898 B
Python
Raw Normal View History

2023-03-20 17:19:42 +00:00
"""
Gunicorn configuration file
"""
2023-03-12 15:08:49 +00:00
from gunicorn.app.base import Application
from gunicorn import util
2023-03-12 18:53:57 +00:00
2023-03-12 15:08:49 +00:00
class OnlyLegs(Application):
2023-03-20 17:19:42 +00:00
"""
Gunicorn application
"""
2023-04-07 12:35:30 +00:00
2023-04-19 18:11:19 +00:00
# TODO: Make this not shit, thanks
def __init__(self, options={}): # skipcq: PYL-W0231 # pylint: disable=W0231
2023-03-12 15:08:49 +00:00
self.usage = None
self.callable = None
self.options = options
self.do_load_config()
2023-03-20 17:19:42 +00:00
2023-03-12 15:08:49 +00:00
def init(self, *args):
2023-03-20 17:19:42 +00:00
"""
Initialize the application
"""
2023-03-12 15:08:49 +00:00
cfg = {}
2023-03-20 17:19:42 +00:00
for setting, value in self.options.items():
if setting.lower() in self.cfg.settings and value is not None:
cfg[setting.lower()] = value
2023-03-12 15:08:49 +00:00
return cfg
2023-03-20 17:19:42 +00:00
@staticmethod
2023-04-19 18:07:18 +00:00
def prog(): # skipcq: PYL-E0202 # pylint: disable=E0202, C0116
2023-04-07 12:35:30 +00:00
return "OnlyLegs"
2023-03-20 17:19:42 +00:00
2023-03-12 15:08:49 +00:00
def load(self):
2023-04-12 17:25:08 +00:00
return util.import_app("onlylegs:create_app()")