miguelgrinberg / microblog-api

A modern (as of 2024) Flask API back end.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how would i add serving static files with return file(filename) in the posts endpoint to return images for the posts

anonhacker47 opened this issue · comments

Returning a file is not a great idea. The post should return image URLs, which I guess you can generate with url_for(). Then for development Flask serves these images, but in production you have a file server that gets these before they get to Flask. For example nginx.