mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-27 16:10:32 +00:00
move db init to web.py
This commit is contained in:
parent
0d6835fe04
commit
6960f076d3
2 changed files with 4 additions and 1 deletions
|
|
@ -2,7 +2,7 @@ from datetime import datetime
|
|||
|
||||
from peewee import *
|
||||
|
||||
database = SqliteDatabase('storage/reticulum-webchat.db')
|
||||
database = DatabaseProxy() # use a proxy object, as we will init real db client inside web.py
|
||||
|
||||
|
||||
class BaseModel(Model):
|
||||
|
|
|
|||
3
web.py
3
web.py
|
|
@ -14,6 +14,8 @@ from aiohttp import web, WSMessage, WSMsgType, WSCloseCode
|
|||
import asyncio
|
||||
import base64
|
||||
|
||||
from peewee import SqliteDatabase
|
||||
|
||||
import database
|
||||
|
||||
|
||||
|
|
@ -29,6 +31,7 @@ class ReticulumWebChat:
|
|||
self.load_config()
|
||||
|
||||
# init database
|
||||
database.database.initialize(SqliteDatabase('storage/reticulum-webchat.db'))
|
||||
self.db = database.database
|
||||
self.db.connect()
|
||||
self.db.create_tables([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue