2020-04-14 22:49:22 +00:00
|
|
|
from peewee import DatabaseProxy, Model
|
|
|
|
from playhouse.db_url import connect
|
2020-08-04 22:25:02 +00:00
|
|
|
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)
|