Images from ImageField in Django don't load in template

后端 未结 7 1395
温柔的废话
温柔的废话 2020-12-08 15:58

I\'m building a gallery using Django(1.5.1) on my local machine. In my Album model I have a ImageField. There is a view to show all images of an album. It works

7条回答
  •  春和景丽
    2020-12-08 16:35

    If you're using the dev server then you need to add something to your urls.py to make django serve the media files, cf:

    1.4.x : https://docs.djangoproject.com/en/1.4/howto/static-files/#serving-other-directories 1.5.x: https://docs.djangoproject.com/en/dev/howto/static-files/#serving-files-uploaded-by-a-user

提交回复
热议问题