Saturday, February 29, 2020

Re: Database connection not pointing to the correct database backend

Hi cam, 
well I solved same problem by removing virtual environment and reinstalling all the packages again.

it worked for me then, I have now access to mysql database  .. 
afterthat you have python 2.xx version pip install <packages>
otherwise python3.xx version pip3 install <packages> 

On Sun, Mar 1, 2020 at 1:51 AM Cam <ctd1077@gmail.com> wrote:
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.

--
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/CA%2BU0cJJhzWha8kFJfC53e6mGVs2KBKzBK5__tKPWpUrx-LfiBQ%40mail.gmail.com.

No comments:

Post a Comment