2021-10-10 10:32:28 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import logging
|
|
|
|
import asyncio
|
|
|
|
|
2021-11-04 17:13:24 +00:00
|
|
|
from obs.api.db import init_models, connect_db
|
2021-11-17 17:33:28 +00:00
|
|
|
from obs.api.app import app
|
2021-10-10 10:32:28 +00:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
logging.basicConfig(level=logging.DEBUG, format="%(levelname)s: %(message)s")
|
|
|
|
|
2021-11-17 17:33:28 +00:00
|
|
|
async with connect_db(app.config.POSTGRES_URL):
|
2021-10-10 10:32:28 +00:00
|
|
|
await init_models()
|
|
|
|
log.info("Database initialized.")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
asyncio.run(main())
|