Sets database dynamically
This commit is contained in:
parent
510f2a5d29
commit
8138e71668
1 changed files with 4 additions and 1 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue