Setting Up Django Setting.py With Mysql Database
Im using mysql in my windows7 for a year and its working fine. I recently know about django and trying to catch up the tutorials. I'm having a problem to set up the setting.py and
Solution 1:
You just need to put the name of the database.
Example:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DB NAME',
'USER': 'USER NAME',
'PASSWORD':'USER PW',
}
}
With that, it should work.
Solution 2:
Try the following:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'PUT THE DATABASE NAME HERE',
'USER': 'PUT THE USER NAME',
'PASSWORD': 'PUT THE PASSWORD OF THE USERNAME ABOVE',
'HOST': 'localhost or hostname/IP of the database server',
'PORT': PORT NUMBER OF THE SERVER,
}
}
You don't need to put the path of any database file, just specify the hostname, port, username and password - and Django will connect to it
Post a Comment for "Setting Up Django Setting.py With Mysql Database"