Django filefield limitation: 100 chars max¶
A colleague just got an error 500 when uploading a file. Two previous uploads were ok, so we started to suspect the quite long filename of that third, failing, file.
I looked in the log file and saw a field length error:
DatabaseError: value too long for type character varying(100)
I looked at Django’s excellent online documentation for the FileField
and saw that, by default it turns into a varchar(100) database column.
This is the first time I’ve personally seen an error come out of it, but at
least it is something to keep in mind. You can change the default by passing a
max_length attribute, so if you need it you can change it.
