def serve_downloads(ver,path=""): if ver == "latest": ver = getVersion() if not len(path): path="schema-all.html" path = "releases/%s/%s" % (ver,path) print("Serving file: " + path) return app.send_static_file(path)
@app.route('/<path>') def serve_terms(path): if not path.endswith(".html"): m = re.match("^([a-z])(.*)$",path) if m: path = "terms/properties/%s/%s%s.html" % (m.group(1),m.group(1),m.group(2)) else: m = re.match("^([0-9A-Z])(.*)$",path) if m: path = "terms/types/%s/%s%s.html" % (m.group(1),m.group(1),m.group(2)) print("Serving file: " + path) return app.send_static_file(path) @app.route('/version/<ver>') @app.route('/version/<ver>/') @app.route('/version/<ver>/<path>') def serve_downloads(ver,path=""): if ver == "latest": ver = getVersion() if not len(path): path="schema-all.html" path = "releases/%s/%s" % (ver,path) print("Serving file: " + path) return app.send_static_file(path) # start the server with the 'run()' method if __name__ == '__main__': print("Local dev server for Schema.org version: %s" % getVersion()) app.run(host=args.host, port=args.port,debug=True)