2023-08-23 14:49:01 +00:00
|
|
|
import asyncio
|
|
|
|
import uvicorn
|
2023-08-23 09:39:03 +00:00
|
|
|
|
|
|
|
from src.app import app
|
|
|
|
from src.env import PORT
|
2023-08-23 14:49:01 +00:00
|
|
|
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__":
|
2023-08-23 14:49:01 +00:00
|
|
|
asyncio.run(main())
|