init
This commit is contained in:
3
app/__init__.py
Normal file
3
app/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from app.app import app
|
||||
from views import *
|
||||
from views.apis import *
|
4
app/api.py
Normal file
4
app/api.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .app import app
|
||||
from flask_restful import Api
|
||||
|
||||
api = Api(app)
|
24
app/app.py
Normal file
24
app/app.py
Normal 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
|
||||
}
|
Reference in New Issue
Block a user