3👍
✅
Your code looks fine to me.
I have to ask the obvious: Does that database actually exist on localhost?
That’s an exception thrown from the MySQLdb module, which makes me think there’s nothing django-specific going wrong here and is why I ask if it’s just a real, low-level error.
Can you access the database from a regular (non django) python script?
Source:stackexchange.com