Adds static files view :param prefix - url prefix :param path - folder with files
(self, prefix, path, *, name=None, expect_handler=None,
chunk_size=256*1024, response_factory=StreamResponse)
| 835 | expect_handler=expect_handler) |
| 836 | |
| 837 | def add_static(self, prefix, path, *, name=None, expect_handler=None, |
| 838 | chunk_size=256*1024, response_factory=StreamResponse): |
| 839 | """ |
| 840 | Adds static files view |
| 841 | :param prefix - url prefix |
| 842 | :param path - folder with files |
| 843 | """ |
| 844 | assert prefix.startswith('/') |
| 845 | if not prefix.endswith('/'): |
| 846 | prefix += '/' |
| 847 | route = StaticRoute(name, prefix, path, |
| 848 | expect_handler=expect_handler, |
| 849 | chunk_size=chunk_size, |
| 850 | response_factory=response_factory) |
| 851 | self.register_route(route) |
| 852 | return route |