mirror of
https://github.com/Kozea/Radicale.git
synced 2025-04-05 06:07:35 +03:00
Simple support for WSGI (no SSL yet)
This commit is contained in:
parent
dcecc68223
commit
2fd6efae14
2 changed files with 146 additions and 258 deletions
|
@ -37,6 +37,7 @@ import sys
|
|||
import optparse
|
||||
import signal
|
||||
import threading
|
||||
from wsgiref.simple_server import make_server
|
||||
|
||||
import radicale
|
||||
|
||||
|
@ -95,13 +96,12 @@ radicale.log.LOGGER.info("Starting Radicale")
|
|||
|
||||
# Create calendar servers
|
||||
servers = []
|
||||
server_class = radicale.HTTPSServer if options.ssl else radicale.HTTPServer
|
||||
shutdown_program = threading.Event()
|
||||
|
||||
for host in options.hosts.split(','):
|
||||
address, port = host.strip().rsplit(':', 1)
|
||||
address, port = address.strip('[] '), int(port)
|
||||
servers.append(server_class((address, port), radicale.CalendarHTTPHandler))
|
||||
servers.append(make_server(address, port, radicale.Application()))
|
||||
|
||||
# SIGTERM and SIGINT (aka KeyboardInterrupt) should just mark this for shutdown
|
||||
signal.signal(signal.SIGTERM, lambda *_: shutdown_program.set())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue