Unable to upload files with Flask on Heroku

前端 未结 2 2026
暗喜
暗喜 2020-12-19 10:32

I\'m attempting to add a file addition button that uploads a file to a folder on my Flask Heroku app but I get an application error when I hit the submit button.

<         


        
2条回答
  •  粉色の甜心
    2020-12-19 11:10

    Heroku is interrupting the request to store data at uploads/ because they prefer you use temporary storage at tmp/

    Any tmp/ files will not be there when the dyno restarts because Heroku filesystems are ephemeral.

    Following the 12-factor app principles, Heroku expects that if your app needs storage you'll use a storage service -- the popular solution is AWS S3 also available as an add-on.

提交回复
热议问题