title: How to encrypt\decrypt files\images Fields in django?
body: <p>I am trying to understand what is the best practice to encrypt a file\image using django drf.</p>
  <p>In my app the user upload sensitive data which I later on store in the cloud.
  The data contains files and images. I wish to encrypt the files in a way that even if someone hack the cloud the data is encrypt.</p>
  <p>as a code exmaple</p>
  <pre><code># models.py
  class FilesHandler(models.Model):
      name = models.TextField(blank=True, null=True)
      # -- File is save in the cloud, use djagno-storages -- #want to add encrypt feature
      my_file= models.FileField(storage=MediaStorage(), upload_to=get_upload_path, blank=True)
      processed = models.BooleanField(default=False)
  </code></pre>
  <p>After a long research I only found the <a href="https://pypi.org/project/django-encrypted-filefield/" rel="nofollow noreferrer">django-encrypted-filefield</a> repo which last commit was done about 2 years ago.In addition I found small amount of data on the topic (could not find even one code example beside the repo mention above).</p>
  <p>Can someone share what is the best pratice to encrypt the data on the server side before sending to the cloud storage? a Django code example link would be <em>appreciated</em></p>
  <h3>Update</h3>
  <p>In the mean time as a &quot;between&quot; solution, I put the following code in</p>
  <pre><code># Serializers.py
  def _encrypt(self, file):
      encrypted = self.aes.encrypt(file.read())
      buffer = io.BytesIO()
      buffer.write(encrypted)
      return buffer
  </code></pre>