Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask & Files
#1
Hi all! :)

I'm trying to build a private update server for my app with Flask.
The app is based on a client-server relationship, when the client runs it shows an icon on the taskbar.
when I choose the update option on the client I want the app to close the current running client app, download the new file from my personal flask server and run it again.

I've managed to get to the point where I can download the file if i'm trying with any browser (chrome, edge etc...).
Is there a way to do that while the client tries to download the file from a windows powershell/cmd command?

In other words, how can I expose the file to more than just the browser?

here's the server's code:

from flask import Flask, render_template, request, make_response, send_file

app = Flask(__name__)
app.debug = True


@app.route('/', methods=['GET'])
def dropdown():
    return render_template('index.html')


@app.route('/update')
def downloadFile ():
    path = r"path\to\file.exe"
    return send_file(path, as_attachment=True)


if __name__ == "__main__":
    app.run()
Thank you for your time :)
Reply
#2
Hi @Gilush,

I would like to help you, but your question seem to miss some context info.

So could you elaborate a little bit more, for example:
- where is located that Flask server (locally, remote)

If I understand well your question, you would like for instance retreive path\to\file.exewith another mean that a web browser.. is that correct ?

Meanwhile if you have solved your problem, let us know.

Cheers,
[Image: NfRQr9R.jpg]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask app cannot read js and css files. Aggam 0 1,631 Nov-04-2020, 12:33 PM
Last Post: Aggam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020