I do not think that you need help in fixing this problem, since you need help in debugging it. Once the problem becomes clear, the solution seems clear. Traceback may be a little obscure because it goes through so much Django source code, and that doesn't tell you which of your fields has a problem.
Background for this problem
For starters, we are having trouble saving a Post instance. Well, look at all of these fields that you have in your model definition:
... url = models.URLField(max_length=250, blank=True, null=True) video = EmbedVideoField(verbose_name='link',help_text="Youtube", blank=True, null=True) content = RichTextUploadingField(config_name='default') image = models.ImageField(upload_to='images',blank=True, null=True) thumbnail = models.ImageField(upload_to='images', blank=True, null=True)
They may not look like text fields, but many of them are variations of text fields, because if you think about it, you are probably not going to store entire files in your database. Instead, you do (and what Django does by default), save the file somewhere on some drive, and then in the database you save the path to that file so that you can get it when you need to.
In addition, this is probably a waste for storing path files in db like LongText or something else, so each FileField we have fields with max_length whether we indicate it or not. Thus, all of the above fields have an implicit max_length . You can find this by reading the source code for Django.
Sample Sources
I never used EmbedVideoField , but it turns out to be a subclass of models.URLField , which means it has max_length set to 200 by default, unless you specify it.
In addition, your various ImageField are simply subclasses of FileField , which has a default max_length of 100 .
How to debug problems like this in the future?
Now this will not help us find out which of your fields produces an error in this case. For this, I would probably set a breakpoint somewhere in the code, perhaps here:
File "ebagu/main/models.py" in save 66. super(Post, self).save(*args, **kwargs)
By setting a breakpoint, I mean the following:
Go to line 65 in the ebagu/main/models.py module mentioned above and enter the following and save the module: import pdb; pdb.set_trace() import pdb; pdb.set_trace()
(I really prefer ipdb myself, but that requires Ipython, and I also have a strong preference ...)
Start the local server and follow the steps that caused this problem. At the end, you will submit your form, and if you look at the console on which you launched your server, you will eventually be dumped into the shell directly on line 65. This is a pdb shell that has different rules from a regular shell, but you can evaluate the Post instance that will be stored in the future by looking at the various fields of the instance itself, self and running Python code in the context of calling this method:
(pdb) len(self.image.path)
Using this, I would manually evaluate the various fields and see which one has this very long record that suffocates the save (probably one of your ImageField s).
Warning solution
Alternatively, you can simply add max_length to all of these, but be warned that you will most likely need to perform database migrations for any limited text field that you change, since your database is still checking the input length for how the column is determined. fooobar.com/questions/704551 / ....
Footnote
Why didn't this appear before you switched to Postgresql? There are many potential reasons, but this is probably due to how the previous database was installed and how the Postgresql database was created (manually or Django migration?).
Perhaps this is also related to whether you have changed where these things are stored. Have you changed the MEDIA settings so that the paths in which the files are stored become much longer?
What you really have to do is look directly at your database. Open a psql instance and ask it to describe your tables for you. It will tell you which fields are limited to 100 characters, and these are the fields that give you problems.