https://docs.djangoproject.com/en/3.1/ref/databases/#mysql-notes
Putting 'database' in conf file does not work, exception raised is:
django.db.utils.InternalError: (1046, 'No database selected')
DB_CONF_PATH = /path/to/conf/file
[client]
database = xxxxx
host =xxxxx
user = xxxxxxx
password = xxxxxx
default-character-set = utf8
But putting it settings.DATABASES dict works.
{{{
DATABASES = {
'default': {
'ENGINE': 'mysql_cymysql',
'OPTIONS': {
'read_default_file': DB_CONF_PATH,
},
'NAME' : 'xxxxxx'
}
}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31969>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => worksforme
* component: Uncategorized => Database layer (models, ORM)
Comment:
It works for me with [https://docs.djangoproject.com/en/3.1/ref/databases
/#connecting-to-the-database the configuration described in docs]:
- `settings.py`:
{{{
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': '/django/tests/mysql.cnf',
}
}
}
}}}
- `/django/tests/mysql.cnf`
{{{
[client]
database = NAME
user = USER
password = PASSWORD
default-character-set = utf8
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31969#comment:1>