FixMiYouShe/main.py

23 lines
602 B
Python
Raw Normal View History

import asyncio
import uvicorn
2023-08-23 09:39:03 +00:00
from src.app import app
from src.env import PORT
from src.render.article import refresh_recommend_posts
async def main():
await refresh_recommend_posts()
web_server = uvicorn.Server(config=uvicorn.Config(app, host="0.0.0.0", port=PORT))
server_config = web_server.config
server_config.setup_event_loop()
if not server_config.loaded:
server_config.load()
web_server.lifespan = server_config.lifespan_class(server_config)
await web_server.startup()
await web_server.main_loop()
2023-08-23 09:39:03 +00:00
if __name__ == "__main__":
asyncio.run(main())