Here is my settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydbname',
'USER': 'username',
'PASSWORD': 'password',
'HOST': '#IP Address that your DB is hosted on'
'PORT': '3306',
}
}
My model is :
class Center(models.Model):
name = models.CharField(max_length=255, unique=True)
englishName = models.CharField(max_length=255, unique=True)
website = models.CharField(max_length=255, unique=True)
def __unicode__(self):
return self.name
And here is the error I see when I try t fetch the data from the DB :
Table `mydbname.dashboard_center` does not exist.
dashboard is the name of my django app. Why does it append it to the table name?
My original table name in my DB is center
Note that: * DB configuration is correct - I am using it in ohter php files. * DB is legacy - I only want to read data from it.
Why does it append the app name? Should I put somewhere the table names or should there be 1-to-1 match between models and table names?
It is my first django app and I am going through the tutorial but I am trying to adjust it on my own stuff.
Am I missing something?
Found that.
I ran this :
and found out what my models need to be. It seems that the difference was the :
that was missing.
Link for the official documentation about using a legacy DB.