chargement initial

This commit is contained in:
CAO Thien-An
2017-07-22 11:25:44 +02:00
parent 6aa83a3286
commit 2093b3588f
285 changed files with 101783 additions and 6 deletions

51
pyramidsvc.py Normal file
View File

@@ -0,0 +1,51 @@
# uncomment the next import line to get print to show up or see early
# exceptions if there are errors then run
# python -m win32traceutil
# to see the output
#import win32traceutil
import win32serviceutil
PORT_TO_BIND = 9180
CONFIG_FILE = 'production.ini'
SERVER_NAME = 'gestion.entreprise-dumas.com'
SERVICE_NAME = "Pyramid_Service"
SERVICE_DISPLAY_NAME = "Pyramid Web Service"
SERVICE_DESCRIPTION = """Permet de laner l'application Pyramid comme un servcie."""
class PyWebService(win32serviceutil.ServiceFramework):
"""Python Web Service."""
_svc_name_ = SERVICE_NAME
_svc_display_name_ = SERVICE_DISPLAY_NAME
_svc_deps_ = None # sequence of service names on which this depends
# Only exists on Windows 2000 or later, ignored on Windows NT
_svc_description_ = SERVICE_DESCRIPTION
def SvcDoRun(self):
from cherrypy import wsgiserver
from pyramid.paster import get_app
from pyramid.paster import setup_logging
import os, sys
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
app = get_app(CONFIG_FILE)
setup_logging(CONFIG_FILE)
self.server = wsgiserver.CherryPyWSGIServer(
('0.0.0.0', PORT_TO_BIND), app,
server_name=SERVER_NAME)
self.server.start()
def SvcStop(self):
self.server.stop()
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(PyWebService)