When I upload an image through Django administrator and I delete the image file again, why does it not delete the image int the /media
directory?
When I delete an image file, I want it to delete the image automatically even from the directory, not only the model instance.
My model:
class ImageForExtractText(models.Model):
image = models.FileField()
And settings:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static")
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media")
What should I do to make it happen, when deleting the image file from Django administration? It should be deleted from both Django administration and the media directory.