Opened 4 years ago
Closed 4 years ago
#31969 closed Bug (worksforme)
'database' option in conf file not working
Reported by: | komaljeet | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I am assumimg this is a bug since as per docs, we should be able to use 'database' in conf file.
It its not a bug, please close the ticket.
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' } }
Change History (1)
comment:1 by , 4 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
It works for me with the configuration described in docs:
settings.py
:/django/tests/mysql.cnf