Django File Field (S3 storage) does not upload file properly

Feature(s) impacted

Django file upload system

Observed behavior

When i want to upload file to S3 storage with the Django storage plugin : Amazon S3 — django-storages 1.5.0 documentation i got this error :

An error occured when trying to edit Expert : (1406, “Data too long for column ‘cv’ at row 1”)

It’s like the file content is going to be saved in database in base64 instead of beeing stored in s3 and the file path in database

class Expert(models.Model):
    cv = models.FileField(upload_to="cv/", null=True, blank=True, max_length=2000)

Expected behavior

It should upload file properly

Failure Logs

An error occured when trying to edit Expert : (1406, “Data too long for column ‘cv’ at row 1”)

Context

  • Project name: Kollectif DevSecOps
  • Team name: Keltio
  • Environment name: Development
  • Agent (forest package) name & version: django-forestadmin==1.4.11
  • Database type: Mysql
  • Recent changes made on your end if any: Nope

Hi @Kevin_Didelot :wave:

If you want to do a specific behavior like here, you should take a look on the documentation about route overinding.
With this you can easily create a file in S3 on your own, get the signed URL and save it to your database.

Let me know if that help :pray: