Downloading a csv file generated by a worker

I am generating a csv file with a worker using celery. The file is generated and when I ssh into the machine I can see the file.

I am then generating a route to download the file, but I cannot seem to find the right “location”?

@app.route(‘/download_generated_csv/’, methods=[‘GET’])
def download_generated_csv(filename):
# Define the directory where the file should be saved
directory = “/workspace/tmp/”
try:
# Try to send the file
return send_file(f"{directory}{filename}", as_attachment=True)
except FileNotFoundError:
# File not found
return jsonify({“error”: “File not found”}), 404

I always get 404. The file name is correct.

I tried saving the file in /tmp and in /workspace/tmp (folder I created)

What am I Missing?

Thanks

Edit: added a volume and saved it there, still not being able to download it!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.