# TODO: Manage smart and configurable logs
import daemon
-from daemon import pidlockfile
+import lockfile
import logging
import optparse
import os
def run_server():
try:
# Launch server
+ log.debug("Starting HTTP%s server on %s:%d" % ("S" if options.ssl else "",
+ options.host if options.host else "*",
+ options.port))
server_class = calypso.HTTPSServer if options.ssl else calypso.HTTPServer
server = server_class(
(options.host, options.port), calypso.CollectionHTTPHandler)
context = daemon.DaemonContext()
context.umask = 0o002
if options.pidfile:
+ from lockfile import pidlockfile
# Generate a pidfile where requested
context.pidfile = pidlockfile.PIDLockFile(options.pidfile)
with context: