3👍
✅
Answering it to mark it resolved.
It was database config issue. I am having different settings file for different environment, and was having mismatch for database config in both files.
3👍
It looks like you are searching for your pk as a string and not an integer, not sure what your query looks like.
as integer, notice no quotes when defining pk_int:
pk_int = 118
Model.objects.get(pk = pk_int)
if your variable containing the pk is a string already, use int():
pk_string = '118'
Model.objects.get(pk = int(pk_string))
- [Django]-Django AbstractBaseUser vs BaseUserManager when creating custom user
- [Django]-X-editable – run code after successful POST?
- [Django]-[django]when debug=false,MEDIA_URL returns not found
- [Django]-When should we use the advanced parameters of save()?
0👍
For anyone coming from a web search engine, if the accepted answer doesn’t work for you, you can also try rebuilding the index:
./manage.py rebuild_index
I had the same error message as the OP, and rebuilding the index solved my issue.
👤Lual
- [Django]-Django: Display contents of txt file on the website
- [Django]-Django channels websocket closes during handshake
- [Django]-Django posts and responses
- [Django]-Django: don't log out when there is an error in view with `request.session.set_exipry`
Source:stackexchange.com