Python 3。
文件树:https://i.imgur.com/p9w0UBm.png
__ main __。py:
import asyncio
from aiohttp import web
from .main import create_app
loop = asyncio.get_event_loop()
app = create_app(debug=True)
web.run_app(app, port=8000)
main.py
import aiohttp_debugtoolbar
from .application import Application, setup_db, setup_logging, setup_middlewares
from .handlers import setup as setup_handlers
from .swagger import setup_swagger
def create_app(debug: bool = False, stage: int = 3):
app = Application()
setup_handlers(app)
setup_swagger(app)
if stage > 1:
setup_middlewares(app)
setup_db(app)
if debug:
aiohttp_debugtoolbar.setup(app)
else:
setup_logging(app)
return app
我从客户那里继承了这个项目。这是我第一次使用aiohttp。我正在尝试在heroku上进行设置。几乎不知道我在做什么。任何帮助表示赞赏。谢谢