fix
This commit is contained in:
parent
4201d9c65a
commit
9cacdc1532
4
app.py
4
app.py
@ -149,13 +149,13 @@ async def get_a1(a1: Optional[str] = None):
|
|||||||
|
|
||||||
|
|
||||||
# 在应用启动时初始化 Playwright
|
# 在应用启动时初始化 Playwright
|
||||||
@app.on_event("startup")
|
@app.lifespan("startup")
|
||||||
async def startup_event():
|
async def startup_event():
|
||||||
await initialize_playwright()
|
await initialize_playwright()
|
||||||
|
|
||||||
|
|
||||||
# 在应用关闭时清理资源
|
# 在应用关闭时清理资源
|
||||||
@app.on_event("shutdown")
|
@app.lifespan("shutdown")
|
||||||
async def shutdown_event():
|
async def shutdown_event():
|
||||||
global playwright_instance, browser_context, context_page
|
global playwright_instance, browser_context, context_page
|
||||||
if context_page:
|
if context_page:
|
||||||
|
@ -4,6 +4,7 @@ module.exports = {
|
|||||||
apps: [
|
apps: [
|
||||||
{
|
{
|
||||||
name: 'xhs-api-server',
|
name: 'xhs-api-server',
|
||||||
|
script: 'app.py', // 替换为您的Python脚本路径
|
||||||
interpreter: 'python', // 替换为您的Python解释器路径
|
interpreter: 'python', // 替换为您的Python解释器路径
|
||||||
args: ['-m uvicorn app:app --host 0.0.0.0 --port', PORT], // 传递端口参数
|
args: ['-m uvicorn app:app --host 0.0.0.0 --port', PORT], // 传递端口参数
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user