Testing my Django App

26 views
Skip to first unread message

Ejike Enyinnaya

unread,
Mar 23, 2020, 11:44:33 AM3/23/20
to Django users
Good day All,

I am currently running a test for my Django app call 'Books'.

Anytime I run an INDEX test, I get the following error below:

"File "/Users/macbookpro/.local/share/virtualenvs/first_django_app-mymO4nCn/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: NOT NULL constraint failed: books_book.user_id"

Please can anyone point to what the issue is or what I am doing wrong. 

Thanks and Regards,

victor awakan

unread,
Mar 23, 2020, 1:57:27 PM3/23/20
to django...@googlegroups.com
Check your book.user_id. It shouldn’t be null. That’s what the last error is saying.

--
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/6de24eab-953f-49b9-9dc4-7aa65dc9e229%40googlegroups.com.

Motaz Hejaze

unread,
Mar 23, 2020, 8:40:59 PM3/23/20
to django...@googlegroups.com
Delete the sqlite database and migrate again to remake it

Reply all
Reply to author
Forward
0 new messages