Python Forum
Flask, send_from_directory not working : solved
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask, send_from_directory not working : solved
Hi everyone,

here my simple test code :

def download():
		return send_from_directory('C:\\original.jpg', filename='original.jpg', as_attachment=True)
	except FileNotFoundError:
No matter what I try I get in the Internet browser

Quote:Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

and this message is not even triggered by the except :/

Any ideas ?
The clue is in the name of the function: the first argument should be the directory (see the docs).
SpongeB0B likes this post
Thank you @ndc85430 !!

it's was so simple ! I'm ashamed.... I'll try to find this tutorial where I have found this bad example/mistake !

Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up Flask do not accept sub-folder in Template ?! : Solved SpongeB0B 2 971 Jan-15-2021, 08:09 AM
Last Post: ndc85430
  My flask website not working properly Aggam 2 749 Nov-03-2020, 09:53 AM
Last Post: Aggam
  Flask, Posgresql - Multiple requests are not working bmaganti 5 1,293 Feb-20-2020, 03:02 PM
Last Post: bmaganti
  Flask Streaming not working on IIS Windows Revencu 0 1,101 Nov-09-2019, 10:31 PM
Last Post: Revencu
  flask app to save images locally when deployed on heroku not working Prince_Bhatia 1 3,339 Feb-20-2019, 11:59 PM
Last Post: snippsat
  Serving mixed filenames with send_from_directory() errors out. nikos 0 1,157 Sep-20-2018, 03:11 AM
Last Post: nikos
  Cannot serve file with send_from_directory nikos 2 1,391 Sep-19-2018, 09:25 PM
Last Post: nikos

Forum Jump:

User Panel Messages

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