bottle with iframe including local resources

70 views
Skip to first unread message

gNeandr

unread,
Sep 20, 2021, 4:31:21 AM9/20/21
to bottlepy

For a bottle based app that runs successfully on a Raspberry, web pages should be displayed inside iframe.
Inside the iframe HTML code should be displayed which is also stored on the RPI inside the app file structure. It is unclear what is the correct addressing for web pages. It is quite unclear for images within the web document to be displayed, where the images are also in the project structure.
The following routine allows the display of html code, but included image links are not resolved correctly.

@app.route('/docs')
def openDocs():
    caller = request.fullpath[1:]
    qString = urllib.parse.unquote(request.query_string.strip())
    logSys("### docs::" + caller +" " + qString)

    if (caller == "docs"):
        docName = "docs/de." + qString + ".html"
        docFile = open(docName, 'r')
        docLines = docFile.read()
        return docLines

Reply all
Reply to author
Forward
0 new messages