costapy/costa.py

26 lines
737 B
Python
Raw Normal View History

2022-03-16 11:06:52 +07:00
import sys
import cherrypy
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])
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")