etwist/server.py
branchstable
changeset 5659 755f56f01c9d
parent 5553 646737f80c88
child 5660 97343804414b
equal deleted inserted replaced
5649:a07dee204187 5659:755f56f01c9d
    39 from twisted.web.server import NOT_DONE_YET
    39 from twisted.web.server import NOT_DONE_YET
    40 
    40 
    41 from cubicweb.web import dumps
    41 from cubicweb.web import dumps
    42 
    42 
    43 from logilab.common.decorators import monkeypatch
    43 from logilab.common.decorators import monkeypatch
    44 from logilab.common.daemon import daemonize
       
    45 
    44 
    46 from cubicweb import AuthenticationError, ConfigurationError, CW_EVENT_MANAGER
    45 from cubicweb import AuthenticationError, ConfigurationError, CW_EVENT_MANAGER
    47 from cubicweb.web import Redirect, DirectResponse, StatusResponse, LogOut
    46 from cubicweb.web import Redirect, DirectResponse, StatusResponse, LogOut
    48 from cubicweb.web.application import CubicWebPublisher
    47 from cubicweb.web.application import CubicWebPublisher
    49 from cubicweb.web.http_headers import generateDateTime
    48 from cubicweb.web.http_headers import generateDateTime
   392     logger = getLogger('cubicweb.twisted')
   391     logger = getLogger('cubicweb.twisted')
   393     if not debug:
   392     if not debug:
   394         if sys.platform == 'win32':
   393         if sys.platform == 'win32':
   395             raise ConfigurationError("Under windows, you must use the service management "
   394             raise ConfigurationError("Under windows, you must use the service management "
   396                                      "commands (e.g : 'net start my_instance)'")
   395                                      "commands (e.g : 'net start my_instance)'")
       
   396         from logilab.common.daemon import daemonize
   397         print 'instance starting in the background'
   397         print 'instance starting in the background'
   398         if daemonize(config['pid-file']):
   398         if daemonize(config['pid-file']):
   399             return # child process
   399             return # child process
   400     root_resource.init_publisher() # before changing uid
   400     root_resource.init_publisher() # before changing uid
   401     if config['uid'] is not None:
   401     if config['uid'] is not None: