v25/dev-main.py
timotheyca ad479a615a DB rework
.check model
config
2020-08-06 01:18:16 +03:00

27 lines
551 B
Python

import json
from typing import Any, Dict
from flask import Flask
from werkzeug.middleware.dispatcher import DispatcherMiddleware
import config
from v25.storage.dbstorage import DBStorage
from v25.web.server.api import API
def simple(_env, resp):
resp(b'404 OK', [])
return []
with open('config.json') as f:
d: Dict[str, Any] = json.load(f)
config.from_config(d)
app = Flask(__name__)
app.wsgi_app = DispatcherMiddleware(simple, {
'/api': API(__name__, DBStorage(d['db']))
})
app.config['ENV'] = 'development'
app.run(port=5013)