4👍
# for mysql connector use this
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'dbname',
'USER': 'user',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '3306',
},
}
2👍
If you’re using Oracle’s connector, you need to use their Django db backend.
See their documentation.
1👍
Try: pip install mysql-python
If that does not work: make sure you can connect to your database (use phpmyadmin or mysql workbench to test that)
- [Django]-Django Admin Custom Widget for ForeignKey
- [Django]-Django: export current queryset to csv by button click in browser
- [Django]-Django: how to filter on subset of many-to-many field?
1👍
try this for MySQL Connector that working in django:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'djangolearn',
'USER': 'root',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '3306',
}
}
or try this for MySQL Connector pool that working in django:
DATABASES = {
'default': {
'ENGINE': 'PyMysqlPool.mysql.connector.django',
'NAME': 'djangolearn',
'USER': 'root',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '3306',
'OPTIONS': {
'autocommit': True,
'pool': {
#use = 0 no pool else use pool
"use":0,
# size is >=0, 0 is dynamic pool
"size":10,
#pool name
"name":"local",
}
},
}
}
- [Django]-How to change the height of the parent div of a plotly_app iframe in python/django?
- [Django]-Django cannot find my templatetags, even though it's in INSTALLED_APPS and has a __init__.py
Source:stackexchange.com