Advertisements
About the issue
I created the project using command django-admin startproject test
and updated the settings file to have mysql database details. Apart from that nothing added/updated/deleted in code.
Database details in config file
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
"Name": "django",
"User": "root",
"Password": "",
"Host": "localhost",
"Port": "3306"
}
}
Then ran the command python manage.py runserver
and gave me very strange error.
It says Access denied for user pankaj@localhost
Question
Settings file has username = root, why django pick operating system username
>Solution :
Django settings names must be all uppercase.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
"NAME": "django",
"USER": "root",
"PASSWORD": "",
"HOST": "localhost",
"PORT": "3306"
}
}