collector/database.py

13 lines
257 B
Python

from peewee import DatabaseProxy, Model
from playhouse.db_url import connect
import config
DB = DatabaseProxy()
class BaseModel(Model):
class Meta:
database = DB
def initialize_db():
db = connect(config.DATABASE_URL)
DB.initialize(db)