def main(): command_configs = { '-t': { 'longInputForm': '--target', 'field': 'target', }, '-i': { 'longInputForm': '--input-file-label', 'field': 'input_file_label', }, } commands = parse_commands(sys.argv[1:], command_configs) if commands.target == 'hw5': hw5.run_all(commands) elif commands.target == 'project': project.run(commands) else: target_list = ['hw5', 'project'] raise RuntimeError( 'Please select "target" among these list: ' + target_list)
async def handle_project(request): json = request.json res = {"x": '0.5', "y": '0.5'} try: res = project.run(json['view']) res['x'] = str(res['x']) res['y'] = str(res['y']) except: print("-") # sanic的json dumps int有bug,需提前转为str return response.json(res)
import project if __name__ == "__main__": project.run()
from flask import Flask import project project = Flask(project) project.run(port=5000, debug=True)