fix: switch compose entrypoint to python module and enable asyncio debug in app.py

- Comment out gunicorn entrypoint in compose.yml and use python -m snek.app instead
- Add asyncio import and create async main() function in app.py
- Enable asyncio event loop debug mode via loop.set_debug(True)
- Replace direct web.run_app call with asyncio.run(main()) for proper async context
This commit is contained in:
2025-02-18 11:28:49 +00:00
parent 81cc2a9645
commit edafacf83a
2 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -1,5 +1,7 @@
import pathlib
import asyncio
from aiohttp import web
from aiohttp_session import (
get_session as session_get,
@@ -29,6 +31,7 @@ from snek.view.web import WebView
from snek.view.upload import UploadView
from snek.view.search_user import SearchUserView
SESSION_KEY = b"c79a0c5fda4b424189c427d28c9f7c34"
@@ -121,8 +124,11 @@ class Application(BaseApplication):
return await super().render_template(template, request, context)
app = Application(db_path="sqlite:///snek.db")
async def main():
app = Application(db_path="sqlite:///snek.db")
loop = asyncio.get_event_loop()
loop.set_debug(True)
await web._run_app(app, port=8081, host="0.0.0.0")
if __name__ == "__main__":
web.run_app(app, port=8081, host="0.0.0.0")
asyncio.run(main())