-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if __name__ == '__main__' for main examples. #3775
Comments
I quite don't follow what exact code should be wrapped? |
sorry, yes in the documentation the server example should become: from aiohttp import web
async def handle(request):
name = request.match_info.get('name', "Anonymous")
text = "Hello, " + name
return web.Response(text=text)
app = web.Application()
app.add_routes([web.get('/', handle),
web.get('/{name}', handle)])
if __name__ == '__main__':
web.run_app(app) So that importing the module doesn't run the server. |
I'm fine with the proposal |
will do next week and fix my other PR. |
NewUserHa
added a commit
to NewUserHa/aiohttp-devtools
that referenced
this issue
May 16, 2019
samuelcolvin
pushed a commit
to aio-libs/aiohttp-devtools
that referenced
this issue
May 17, 2019
* aio-libs/aiohttp#3775 * Update README.rst * fix linting
3 tasks
asvetlov
pushed a commit
that referenced
this issue
May 21, 2019
asvetlov
pushed a commit
that referenced
this issue
May 21, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
aio-libs/aiohttp-devtools#229
Would be useful if we wrapped
web.run_app(app)
if a main check:To work with aiohttp-devtools and other such tools.
If you're happy with this I'll submit a PR.
The text was updated successfully, but these errors were encountered: