About Deleting a Directory and its Files from Media
Use the following function to delete a directory under media root:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Then you would call it like so:
1 |
|
It works not only with a simple file system, but also with Amazon S3, DigitalOcean Spaces, or a similar remote storage when using django-storages
.
Tips and Tricks Programming Architecture Development Django 5.x Django 4.2 Django 3.2 django-storages
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.