Hi Sean,

I just found your wiki page.  Great job! :-)

I tried out your code, but I have a problem.  The service installs and
starts alright, but when I try to browse to my site, nothing shows up.
More specifically, The request is sent and then the browser is just left
there waiting.  It does not even time out (at least not quickly).

Anyway, I had previously created a service based on the CherryPy recipe
and it works.  So I'm just wondering why one would work and not the
other.  So far, I have not been able to figure it out.

Maybe someone here can help me out?  It's probably some dumb mistake on
my part. :-)

I am including the relevant bits from your code as well as my
CherryPy-based code.

Thanks in advance,
Krys

----- Snippet from Sean's code.          -----
----- File: c:\marvin\marvin\servcice.py -----

# -- START USER EDIT SECTION
_svc_name_ = 'MarvinService'
_svc_display_name_ = 'Marvin Web Application Server'
_svc_description_ = "MPDD's services portal web application server"
code_dir = r'c:\marvin\marvin'
root_class = 'marvin.controllers.Root'
og_dir = r''
# -- END USER EDIT SECTION

----- My modified CherryPy service code.       -----
----- File: C:\marvin\marvin\marvin-service.py -----

"""
The Marvin CherryPy 2.1 Windows NT service.
"""

from os import chdir
from os.path import dirname
import cherrypy
from win32serviceutil import ServiceFramework, HandleCommandLine
from win32service import SERVICE_STOP_PENDING
from win32event import CreateEvent, WaitForSingleObject, INFINITE, SetEvent


class MarvinService(ServiceFramework):
  """Marvin Windows NT Service."""

  _svc_name_ = 'Marvin'
  _svc_display_name_ = 'Marvin Web Application Server'
  _svc_description_ = "MPDD's services protal web application server"

  def __init__(self, args):
    ServiceFramework.__init__(self, args)
    # create an event that SvcDoRun can wait on and SvcStop
    # can set.
    self.stop_event = CreateEvent(None, 0, 0, None)

  def SvcDoRun(self):
    chdir(dirname(__file__))
    cherrypy.config.update(file = 'prod.cfg')
    from marvin.controllers import Root
    cherrypy.root = Root()
    # set initOnly = True so that start() does not block
    cherrypy.server.start(initOnly = True)
    # now, block until our event is set...
    WaitForSingleObject(self.stop_event, INFINITE)

  def SvcStop(self):
    self.ReportServiceStatus(SERVICE_STOP_PENDING)
    cherrypy.server.stop()
    SetEvent(self.stop_event)


if __name__ == '__main__':
  HandleCommandLine(MarvinService)


----- End -----


Sean De La Torre wrote:
> I've just added a new page to the wiki with a full set of instructions
> on how to install TG as a Windows service (see
> http://trac.turbogears.org/turbogears/wiki/DeployAsWindowsService).
> Included on that page is a fully documented/cleaned up file that users
> can use to deploy their applications.
> 
> I was also able to get TG to run using Apache/FastCGI on my
> dreamhost.com account.  If anyone is interested, please let me know and
> I'll write that one up as well.
> 
> Sean
> 
> 

Reply via email to