24 lines
541 B
Python
24 lines
541 B
Python
import yaml
|
|
|
|
from flask import Flask
|
|
from utils.json_encoder import JSONEncoder
|
|
from os.path import dirname, abspath, join
|
|
|
|
class Config():
|
|
pass
|
|
|
|
with open('config/config.yaml', 'r') as f:
|
|
config_yaml = yaml.safe_load(f)
|
|
|
|
config = Config()
|
|
for k, v in config_yaml.items():
|
|
setattr(config, k, v)
|
|
|
|
app = Flask(__name__,
|
|
root_path=join(dirname(abspath(__file__)), '..'), template_folder="config")
|
|
app.config.from_object(config)
|
|
|
|
app.json_encoder = JSONEncoder
|
|
app.config['RESTFUL_JSON'] = {
|
|
'cls': app.json_encoder
|
|
} |