-
-
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
Improvements to static routes #468
Comments
Sounds good. |
Ok, will try to make a PR today or next week |
IMO router shouldn't have anything related to serving files. We can have some handler for this: from aiohttp import handlers
app.router.add_route('GET', '/media/', handlers.static('/var/www/media/', indexes=True)) As for HEAD we can allow specifying multiple methods: app.router.add_route({'GET', 'HEAD'}, 'media', handlers.static('/var/www/media/')) And ok. We can still have an alias for setting static route, which will just call add_route with proper handler: app.router.add_static('/static/', static_dir, name='static') and inside add_static: def add_static(self, *args, **kw):
self.add_route({'GET', 'HEAD'}, handlers.static(*args, **kw)) |
@redixin path param for |
@redixin, you mentined |
Great suggestion on having handlers for serving static files. Totally agreed with it! |
Plzz, illustrate where the docs for this solution. 💃 |
@redixin Thank you |
Thanks to @dkuznetsov and #901 now we have a |
I got into two problems with static routes recently,
Workaround to 1st problem,
Not very elegant solution, IMO
Workaround to 2nd problem,
In total, I propose imrpove static routes by,
The text was updated successfully, but these errors were encountered: