Saturday, February 29, 2020

Database connection not pointing to the correct database backend

I'm running Ubuntu and I'm trying to create a small web-app connecting to a mysql database. (I've also tried sql-server database and had the same issue)

It took me awhile the first time I did this but I was able to get it to work using
 'ENGINE': 'mysql.connector.django',


This time around I'm doing the same thing with the same database but I want to use 
'ENGINE': 'django.db.backends.mysql',


Here are the packages I've installed
pip freeze
asgiref
==3.2.3
Django==3.0
django
-mysql==3.3.0
dnspython
==1.16.0
mysqlclient
==1.4.6
protobuf
==3.6.1
PyMySQL==0.9.3
pyodbc
==4.0.28
pytz
==2019.3
six
==1.14.0
sqlparse
==0.3.0


settings.py:

DATABASES = {
   
'default': {
       
'NAME': 'inventory',
       
'ENGINE': 'django.db.backends.mysql',
       
'HOST': 'localhost',
       
'USER': 'root',
       
'PASSWORD': 'xxxx',
       
'PORT': '3306',

   
}
}




However I'm still getting this error when trying to run migrate:
Traceback (most recent call last):
 
File "/home/cam/.local/share/virtualenvs/Parts_Project-YIqPqjtZ/lib/python3.6/site-packages/django/db/utils.py", line 111, in load_backend
   
return import_module('%s.base' % backend_name)
....
django
.core.exceptions.ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend.
Try using '
django.db.backends.XXX', where XXX is one of:
    '
oracle', 'postgresql', 'sqlite3'




I've searched this problem over and over again online, 

none of these solutions have worked for me. 

I've obviously not pointing to the correct database backend.



Any ideas?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3ecf8944-b73d-480a-9875-ffe12a71224c%40googlegroups.com.

No comments:

Post a Comment