58 views
Skip to first unread message

ola neat

unread,
Oct 8, 2021, 4:12:47 PM10/8/21
to django...@googlegroups.com
Hello guys
I've got this issue i don't understand, before i deployed my  APIS to heroku everything was working perfectly, but now that i deployed I'm getting this error, pls can anyone help me? 
IMG-20211008-WA0004.jpg

Sebastian Jung

unread,
Oct 8, 2021, 5:53:39 PM10/8/21
to django...@googlegroups.com
Hello,

Your app tries to insert a new entry in table auth.users. in this table a User exists with id=2 and you get this constraint error. Please truncate auth.users table and try it again.

Regards

ola neat <tosina...@gmail.com> schrieb am Fr., 8. Okt. 2021, 18:12:
Hello guys
I've got this issue i don't understand, before i deployed my  APIS to heroku everything was working perfectly, but now that i deployed I'm getting this error, pls can anyone help me? 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHLKn727okM8xWxX2o7ZgSLT6pDFXQf_oS6NC-83K7zkv9NhXw%40mail.gmail.com.

ola neat

unread,
Oct 9, 2021, 6:51:50 AM10/9/21
to django...@googlegroups.com

Hubert Kanyamahanga

unread,
Oct 9, 2021, 7:07:57 AM10/9/21
to django...@googlegroups.com
Hi Ola, I see where the issue is, the line self.perform_create(serializer) on the def create() method creates as well as the line serializer.save() on the method def post(). So in other words, you are trying to create the same user twice, please comment one of them if you want you can empty your table and start again it will work.

Again there is no reason to use these two methods as they do the same thing. Remove completely either the post or the create.

You can text me on whatsApp if you need more support: +221777922780

Best, 

H


Screenshot from 2021-10-09 06-59-25.png
Screenshot from 2021-10-09 07-00-00.png

ola neat

unread,
Oct 9, 2021, 7:15:19 AM10/9/21
to django...@googlegroups.com
But it working on localhost without issues 

Sebastian Jung

unread,
Oct 9, 2021, 7:16:33 AM10/9/21
to django...@googlegroups.com

ola neat

unread,
Oct 9, 2021, 7:26:20 AM10/9/21
to django...@googlegroups.com

Sebastian Jung

unread,
Oct 9, 2021, 7:27:58 AM10/9/21
to django...@googlegroups.com
I mean same database and not same database system...

Hubert Kanyamahanga

unread,
Oct 9, 2021, 7:32:26 AM10/9/21
to django...@googlegroups.com
Can you write to me on whatsapp so that I can  provide more help or even skype or telegram


From: django...@googlegroups.com <django...@googlegroups.com> on behalf of Sebastian Jung <sebasti...@gmail.com>
Sent: Saturday, October 9, 2021 7:26:44 AM
To: django...@googlegroups.com <django...@googlegroups.com>
Subject: Re:
 

Sebastian Jung

unread,
Oct 9, 2021, 11:10:43 AM10/9/21
to django...@googlegroups.com
Hello,

No only friends get social media or WhatsApp.

I think yoz need a experience developer. Try to get one developer on upwork. I have no expeeience with serializer...

Regards



Ahmad Abdulnasir Shuaib

unread,
Oct 9, 2021, 1:27:17 PM10/9/21
to django...@googlegroups.com
Check your models, you may have unique_together option enabled.

ola neat

unread,
Oct 9, 2021, 2:00:34 PM10/9/21
to django...@googlegroups.com
But it working perfectly offline

Sebastian Jung

unread,
Oct 9, 2021, 2:54:49 PM10/9/21
to django...@googlegroups.com
Have you truncate table auth_users?

Waqas Ali

unread,
Oct 19, 2021, 12:28:54 PM10/19/21
to django...@googlegroups.com
Hi Maryam whare you from?
Reply all
Reply to author
Forward
0 new messages