ファイルを扱う際に便利なアイテム¶ まずDjangoはインストール済みとして、ファイルを扱う際に便利なアイテムをインストールします。 それは「django-cleanup」ライブラリです。 django-cleanup PyPI django-cleanupを使用することで、ファイルが削除・更新された際に実際のファイルも削除してくれます。 通常ですとデータを削除したと思っても、実際保存されているデータはファイルの「パス」、つまりURLに過ぎないので、ファイル本体は削除されていません。 もしファイルの本体も削除するのであれば手動で消すことになるので大変面倒になります。 なので、django-cleanupを使用する場合はインストールしておきましょう。 # 実行 $ pip install django-cleanup settings.pyのINSTALLED_APPSにも記述しておきます。