collector/database.py

14 lines
312 B
Python
Raw Normal View History

2020-04-14 22:49:22 +00:00
from peewee import DatabaseProxy, Model
from playhouse.db_url import connect
from playhouse.pool import PooledPostgresqlExtDatabase
2020-04-14 22:49:22 +00:00
import config
DB = DatabaseProxy()
class BaseModel(Model):
class Meta:
database = DB
def initialize_db():
db = connect(config.DATABASE_URL)
DB.initialize(db)