|
@@ -3,6 +3,8 @@
|
|
|
Writing a custom storage system
|
|
|
===============================
|
|
|
|
|
|
+.. currentmodule:: django.core.files.storage
|
|
|
+
|
|
|
If you need to provide custom file storage -- a common example is storing files
|
|
|
on some remote system -- you can do so by defining a custom storage class.
|
|
|
You'll need to follow these steps:
|
|
@@ -35,8 +37,16 @@ You'll need to follow these steps:
|
|
|
the ``path()`` method.
|
|
|
|
|
|
Your custom storage system may override any of the storage methods explained in
|
|
|
-:ref:`ref-files-storage`. However, it's usually better to use the hooks
|
|
|
-specifically designed for custom storage objects. These are:
|
|
|
+:ref:`ref-files-storage`, but you **must** implement the following methods:
|
|
|
+
|
|
|
+ * :meth:`Storage.delete`
|
|
|
+ * :meth:`Storage.exists`
|
|
|
+ * :meth:`Storage.listdir`
|
|
|
+ * :meth:`Storage.size`
|
|
|
+ * :meth:`Storage.url`
|
|
|
+
|
|
|
+You'all also usually want to use hooks specifically designed for custom storage
|
|
|
+objects. These are:
|
|
|
|
|
|
``_open(name, mode='rb')``
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|