Simple Django Image Upload - Image file not saving

前端 未结 3 1193
说谎
说谎 2021-02-11 05:42

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:38

    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.

提交回复
热议问题