Skip to content

Commit d173517

Browse files
Update main.py
1 parent 5b9d99f commit d173517

File tree

1 file changed

+7
-3
lines changed
  • frameworks/Python/aiohttp/app

1 file changed

+7
-3
lines changed

frameworks/Python/aiohttp/app/main.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import os
21
import multiprocessing
2+
import os
3+
import platform
34

4-
import asyncpg
55
from aiohttp import web
66
from sqlalchemy.engine.url import URL
77
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
@@ -20,6 +20,9 @@
2020
updates_raw,
2121
)
2222

23+
if platform.python_implementation() != "PyPy":
24+
import asyncpg
25+
2326
CONNECTION_ORM = os.getenv('CONNECTION', 'ORM').upper() == 'ORM'
2427

2528

@@ -84,6 +87,7 @@ def setup_routes(app):
8487

8588
def create_app():
8689
app = web.Application()
87-
app.cleanup_ctx.append(db_ctx)
90+
if platform.python_implementation() != "PyPy":
91+
app.cleanup_ctx.append(db_ctx)
8892
setup_routes(app)
8993
return app

0 commit comments

Comments
 (0)