mirror of
https://github.com/RYDE-WORK/MediaCrawler.git
synced 2026-02-01 13:53:29 +08:00
Merge pull request #136 from jayeeliu/main
增加sqlite配置示例,解决用sqlite保存数据时,抓取结束不退出的问题
This commit is contained in:
commit
67d2b7cff8
@ -7,3 +7,6 @@ REDIS_DB_PWD = os.getenv("REDIS_DB_PWD", "123456") # your redis password
|
|||||||
# mysql config
|
# mysql config
|
||||||
RELATION_DB_PWD = os.getenv("RELATION_DB_PWD", "123456") # your relation db password
|
RELATION_DB_PWD = os.getenv("RELATION_DB_PWD", "123456") # your relation db password
|
||||||
RELATION_DB_URL = f"mysql://root:{RELATION_DB_PWD}@localhost:3306/media_crawler"
|
RELATION_DB_URL = f"mysql://root:{RELATION_DB_PWD}@localhost:3306/media_crawler"
|
||||||
|
|
||||||
|
# sqlite3 config
|
||||||
|
# RELATION_DB_URL = f"sqlite://data/media_crawler.sqlite"
|
||||||
2
db.py
2
db.py
@ -18,6 +18,8 @@ async def init_db(create_db: bool = False) -> None:
|
|||||||
_create_db=create_db
|
_create_db=create_db
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def close() -> None:
|
||||||
|
await Tortoise.close_connections()
|
||||||
|
|
||||||
async def init():
|
async def init():
|
||||||
await init_db(create_db=True)
|
await init_db(create_db=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user