memindahkan db dan membuat fungsi untuk membuat folder db
This commit is contained in:
parent
815ee6d52c
commit
15b4df3696
2 changed files with 11 additions and 4 deletions
6
main.py
6
main.py
|
@ -167,9 +167,9 @@ async def jalan():
|
||||||
await asyncio.sleep(2)
|
await asyncio.sleep(2)
|
||||||
await getNotif()
|
await getNotif()
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
await kirim_ke_tele()
|
# await kirim_ke_tele()
|
||||||
await asyncio.sleep(5)
|
# await asyncio.sleep(5)
|
||||||
await tandai_notif()
|
# await tandai_notif()
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -7,9 +7,16 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
db_dir = f"{cwd}/db"
|
||||||
|
|
||||||
|
if not os.path.exists(db_dir):
|
||||||
|
print("Folder db tidak ditemukan, membuat folder db")
|
||||||
|
os.makedirs(db_dir)
|
||||||
|
else:
|
||||||
|
print("Tidak bisa membuat folder db, silakan membuat secara manual folder db")
|
||||||
|
|
||||||
# Engine
|
# Engine
|
||||||
engine = create_engine(f"sqlite:///{cwd}/gotodon.db")
|
engine = create_engine(f"sqlite:///{db_dir}/gotodon.db")
|
||||||
|
|
||||||
# Base
|
# Base
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
Loading…
Reference in a new issue