Answer the question
In order to leave comments, you need to log in
How to fix the value does not fit in the character varying(50) type?
Colleagues, welcome!
I bring the image files into the database using the link.
Got a very strange error: django.db.utils.DataError: ERROR: value does not fit character varying(50).
img_name1 = urlparse(image).path.split('/')[-1]
response = requests.get(image)
if response.status_code == 200:
product.image.save(img_name1, ContentFile(response.content), save=True)
product.image.save(img_name1, ContentFile(response.content), save=True)
Answer the question
In order to leave comments, you need to log in
who will google even after so many years - change the type to varchar (255) or varchar (500) for example, or if even this was not enough for you, then change to TEXT type - here the column limit is almost 1 GB
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question