Adding react static file handler (rewriter)

This commit is contained in:
James Barnsley
2019-12-27 14:10:01 +13:00
parent d5028cef21
commit e59cd5a253
3 changed files with 10 additions and 7 deletions

View File

@ -64,14 +64,17 @@ class ReactRouterHandler(tornado.web.StaticFileHandler):
super(ReactRouterHandler, self).initialize(self.dirname) super(ReactRouterHandler, self).initialize(self.dirname)
def get(self, path=None, include_body=True): def get(self, path=None, include_body=True):
super(ReactRouterHandler, self).get(self.path, include_body) print(self.path)
print(include_body)
print('-------------')
super(ReactRouterHandler, self).get(self.path)
## ##
# Frontend factory # Frontend factory
## ##
def iris_factory(config, core): def iris_factory(config, core):
path = pathlib.Path(__file__).parent / "static" path = pathlib.Path(__file__).parent / 'static'
return [ return [
( (
@ -94,7 +97,7 @@ def iris_factory(config, core):
r'/assets/(.*)', r'/assets/(.*)',
tornado.web.StaticFileHandler, tornado.web.StaticFileHandler,
{ {
'path': str(path)+'/assets' 'path': path / 'assets'
} }
), ),
( (
@ -106,8 +109,8 @@ def iris_factory(config, core):
), ),
( (
r'/(.*)', r'/(.*)',
tornado.web.StaticFileHandler, { ReactRouterHandler, {
'path': str(path) 'path': path / 'index.html'
} }
), ),
] ]

File diff suppressed because one or more lines are too long

View File

@ -100,7 +100,7 @@
// Release details // Release details
// These are automatically injected to built HTML // These are automatically injected to built HTML
var build = "1576347780"; var build = "1577407399";
var version = "3.43.0"; var version = "3.43.0";
// Construct the script tag // Construct the script tag