core part of API
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
app = Flask("test_flaskon")
app = FlaskonfAPI("test_flaskonf")
Configuration directory
!ls ../tests/confs/
Example directory
!ls ../tests/examples/guide_shanghai
!cat ../tests/examples/guide_shanghai/print_all.json
app.build_on_config(confs_dir="../tests/confs/",examples_dir="../tests/examples/" )
@app.conf_route("/guide2/", nobuild=True)
def guide_api(inputs: Dict):
data = inputs['data']
conf = data["conf"]
user = data["user"]
return {"city_data2": conf, "user": user}
@app.conf_route("/guide/")
def build_city_guide(conf_file: str, conf: Dict):
logging.info(f"{conf}")
# doing other things for building API here
# like load huge model into memory with configuration
def guide_api(inputs: Dict):
data = inputs['data']
user = data["user"]
return {"city_data": conf, "user": user}
return guide_api
app.build_flaskonf()
app.run(host="0.0.0.0",port=9727)