Simple Django Image Upload - Image file not saving

前端 未结 3 1320
走了就别回头了
走了就别回头了 2021-02-11 05:56

Right I\'m learning how to do a simple image upload form to upload an image to MEDIA_ROOT. The form renders fine, I get no errors, but the file is not showing up in the MEDIA_RO

3条回答
  •  独厮守ぢ
    2021-02-11 06:47

    You need to attach it to a model (as an ImageField) as it's not being saved anywhere presently. It may be handled without any issues right now but it gets discarded after the view returns.

    Never mind, I didn't realize models were unnecessary.

提交回复
热议问题