37 lines
891 B
Python
37 lines
891 B
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
"""生产环境启动:Waitress WSGI(Windows 友好)。说明见仓库根目录 windows上唯一启动说明.md。"""
|
|||
|
|
import os
|
|||
|
|
import sys
|
|||
|
|
|
|||
|
|
from waitress import serve
|
|||
|
|
|
|||
|
|
from src.flask_prompt_master import create_app
|
|||
|
|
|
|||
|
|
|
|||
|
|
def main() -> None:
|
|||
|
|
os.environ.setdefault("FLASK_ENV", "production")
|
|||
|
|
app = create_app()
|
|||
|
|
port = int(os.environ.get("PORT", "5000"))
|
|||
|
|
print("=" * 60)
|
|||
|
|
print("Flask 提示词大师 - 生产环境 (Waitress)")
|
|||
|
|
print("=" * 60)
|
|||
|
|
print(f"监听: 0.0.0.0:{port} 按 Ctrl+C 停止")
|
|||
|
|
print("=" * 60)
|
|||
|
|
serve(
|
|||
|
|
app,
|
|||
|
|
host="0.0.0.0",
|
|||
|
|
port=port,
|
|||
|
|
threads=4,
|
|||
|
|
connection_limit=1000,
|
|||
|
|
cleanup_interval=30,
|
|||
|
|
channel_timeout=120,
|
|||
|
|
max_request_body_size=1073741824,
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
try:
|
|||
|
|
main()
|
|||
|
|
except KeyboardInterrupt:
|
|||
|
|
sys.exit(0)
|