"techrec serve" works now

This commit is contained in:
boyska 2021-08-25 14:50:13 +02:00
parent fb79a598da
commit 7e99e31f43

View file

@ -43,6 +43,8 @@ def rec_sanitize(rec):
async def startup_event():
global db
common_pre()
if get_config()['DEBUG']:
logging.basicConfig(level=logging.DEBUG)
db = RecDB(get_config()["DB_URI"])
@app.get("/date/date")
@ -339,6 +341,9 @@ def serve_pages(request: Request):
fpath = os.path.join(get_config()["STATIC_PAGES"], page)
return FileResponse(fpath)
def main_cmd(options):
import uvicorn
uvicorn.run(app, host=get_config()['HOST'], port=int(get_config()['PORT']))
if __name__ == "__main__":
logger.warn("Usage of server.py is not supported anymore; use cli.py")