Sets database dynamically

This commit is contained in:
Oleg Silkin 2020-03-30 18:02:20 -04:00
parent 510f2a5d29
commit 8138e71668

View file

@ -18,12 +18,15 @@ def get_database_connection():
return db return db
database_proxy = DatabaseProxy()
database = get_database_connection() database = get_database_connection()
database_proxy.initialize(database)
class BaseModel(Model): class BaseModel(Model):
class Meta: class Meta:
database = database database = database_proxy
class Channel(BaseModel): class Channel(BaseModel):