This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/core/management/commands/web.py

31 lines
895 B
Python
Raw Normal View History

2019-02-08 13:57:59 +00:00
"""passbook Webserver management command"""
from logging import getLogger
2019-04-11 11:43:49 +00:00
from daphne.cli import CommandLineInterface
2019-02-08 13:57:59 +00:00
from django.core.management.base import BaseCommand
2019-04-11 11:43:49 +00:00
from django.utils import autoreload
2019-02-08 13:57:59 +00:00
2019-04-11 11:43:49 +00:00
from passbook.lib.config import CONFIG
2019-02-08 13:57:59 +00:00
LOGGER = getLogger(__name__)
class Command(BaseCommand):
"""Run CherryPy webserver"""
def handle(self, *args, **options):
"""passbook daphne server"""
2019-04-11 11:43:49 +00:00
autoreload.run_with_reloader(self.daphne_server)
def daphne_server(self):
"""Run daphne server within autoreload"""
autoreload.raise_last_exception()
CommandLineInterface().run([
'-p', str(CONFIG.y('web.port', 8000)),
'-b', CONFIG.y('web.listen', '0.0.0.0'), # nosec
'--access-log', '/dev/null',
2019-04-29 20:19:26 +00:00
'--application-close-timeout', '500',
'passbook.core.asgi:application'
])