2022-03-16 11:06:52 +07:00
|
|
|
import sys
|
|
|
|
import cherrypy
|
2023-01-30 20:09:40 +07:00
|
|
|
import cherrypy_cors
|
2022-03-16 11:06:52 +07:00
|
|
|
import handler
|
|
|
|
|
|
|
|
from config import server
|
|
|
|
from config import directory
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
dirconfig = directory.dirconfig
|
|
|
|
update = server.update
|
|
|
|
|
|
|
|
if len(sys.argv) >= 3:
|
|
|
|
|
|
|
|
update["server.socket_host"] = sys.argv[1]
|
|
|
|
update["server.socket_port"] = int(sys.argv[2])
|
|
|
|
|
2023-01-30 20:09:40 +07:00
|
|
|
cherrypy_cors.install()
|
2022-03-16 11:06:52 +07:00
|
|
|
cherrypy.config.update ( update )
|
|
|
|
cherrypy.quickstart ( handler.handler(), config = dirconfig )
|
|
|
|
|
|
|
|
else:
|
|
|
|
print ("Usage : python<ver> costa.py <ip_address> <port> <service_name>")
|
|
|
|
print ("Example : python3 costa.py localhost 81 CostaPySample")
|