尝试 django-cleanup,当移除模型时,它会自动调用FileField上的delete方法。
pip install django-cleanup
设置 settings.py
INSTALLED_APPS = (
...
'django_cleanup', # should go after your apps
)
尝试 django-cleanup,当移除模型时,它会自动调用FileField上的delete方法。
pip install django-cleanup
设置 settings.py
INSTALLED_APPS = (
...
'django_cleanup', # should go after your apps
)