I have a python socket server that is always offline, that I need to serve an HTML page to a local client, and communicate back and forth. However, when running it offline, it wasn't able to get the remote javascript/css we were using, which is fine, we just downloaded the files and required licenses, and had the html refer to them locally.
This approach worked when just running the .html file, but when the .html file is served up by the socket server, it lacks the javascript and html that the .html is referring to.
We are sending the .html file to the client like so:
sio = socketio.AsyncServer(cors_allowed_origins='*')
app = web.Application()
sio.attach(app)
async def index(request):
with open('./index.html') as f:
return web.Response(text=f.read(), content_type='text/html'
app.router.add_get('/', index)
if __name == '__main__':
web.run_app(app)
We are assuming that, because the server is only sending the .html file, we are not seeing the local js/css being loaded correctly. We would like to know if there is a way to send these files along with the .html file so we can have the page display correctly.