DatabaseError: value too long for type character varying(100)

后端 未结 11 467
北恋
北恋 2021-01-31 02:37

I have a Django web site running a mini CMS we\'ve built internally years ago, it\'s using postgresql. When saving a simple title and a paragraph of text I get the following err

11条回答
  •  猫巷女王i
    2021-01-31 03:09

    Michael Samoylov's answer pointed me in the right direction. I had the same error come up, except it was with a FileField.

    Fields have a max_length, even if you have not explicitly set a max_length. Increase the value so that your data fits to avoid the error.

    In my case, the data was too large to reasonably store in the database. I resorted to saving my file to disk, then saving the file path in the database.

提交回复
热议问题