This commit is contained in:
Sense T
2022-08-08 05:51:01 +00:00
commit 135a9dd01d
16 changed files with 213 additions and 0 deletions

3
app/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
from app.app import app
from views import *
from views.apis import *

4
app/api.py Normal file
View File

@@ -0,0 +1,4 @@
from .app import app
from flask_restful import Api
api = Api(app)

24
app/app.py Normal file
View File

@@ -0,0 +1,24 @@
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__)), '..'))
app.config.from_object(config)
app.json_encoder = JSONEncoder
app.config['RESTFUL_JSON'] = {
'cls': app.json_encoder
}