Using bottle to download a file?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Using bottle to download a file?



In index.html I got the following button:


<button id="btn_file" type="button" class="btn btn-default" onclick="getFile()"><span class="glyphicon glyphicon-file"></span></button>



In my javascript, picoreflow.js, I have this function:


function getFile()

var cmd = "cmd":"DL";
ws_control.send(JSON.stringify(cmd));



And in my picoreflowd.py, this is located in handle_control():


elif msgdict.get("cmd") == "DL":
log.info("Download command received")
static_file("downloadMe.txt", root='/home/pi/V2.3_Test/', download = "downloadMe.txt")



This is my github directory, which has the complete code: https://github.com/Ritzerk/V2.3_Test



I'm trying to work on open-source software, but I don't know anything about web-server. I tried to use static_file like suggested here: Binary file download



But its hard to know what I am doing wrong, since I have no website experience...



What's wrong with the way I am trying to download downloadMe.txt? The button doesn't even display on the website when I load it.



The file is located in the given directory. The V2.3_Test is located in /home/pi/.





How about focusing on one thing? Do the backend first. If it works you can work on the frontend.
– user9455968
Aug 8 at 13:58





@intentionallyleftblank Sorry its literally my first time working with this sort of large application... how do I check just backend..?
– Lukali
Aug 8 at 14:04





The backend would just be Bottle and Python. Then try to download the file in your browser by just entering the URL.
– user9455968
Aug 8 at 14:05









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard