[Fixed]-Wagtail mock images show as broken in admin but visible on template

1👍

Whenever a template (either front-end or within the admin) requires an image at a particular size, it will look in the wagtailimages.Rendition model (or the project-specific Rendition model, if custom image models are in use) to see if one has previously been generated. If so, it will use the existing file; if not, it will generate a new one and add a Rendition record.

If you’re getting a broken image, it most likely means that a Rendition record exists (because it’s been included in your initial data fixture) but the corresponding image file isn’t present in MEDIA_ROOT/images. The proper fix would be to remove the rendition records from your fixture. To fix this after the fact and force all image renditions to be recreated, you can simply delete the contents of the wagtailimages_rendition table.

👤gasman

Leave a comment