I thought this would be simple because of this MySQL tutorial by pythonanywhere, but I'm still having trouble switching over from sqlite3. I'm a beginner to SQL databases, and I've been checking out other stackoverflow questions but I'm not sure where else to go from here. Here's what I've done so far.
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '3DPrince$ubodb',
'USER': '3DPrince',
'PASSWORD': 'secretpassword',
'HOST': '3DPrince.mysql.pythonanywhere-services.com',
},
}
I've also run the following to try and sync the db.
manage.py makemigrations
manage.py migrate
I'm still getting the error that
(1146, "Table '3DPrince$ubodb.django_site' doesn't exist")
I'm not sure what else to do from here and I'm not sure how to do any sort of checks from the mysql bash console.
Can anyone point out what I'm doing wrong? Or maybe some useful mysql bash commands to check the connection or manually remake the db?
It looks like something went wrong with the migration. I would recommend you to do following steps that re-create your db.
Make a backup of your data in the database!!!
Connect to your remote database:
Delete your current database and create it again:
Locally (in another terminal's tab) migrate your django project:
Check (in the tab where you're connected to the remove database) that all tables have been created correctly:
If something goes wrong you will see warnings or errors.
And also you don't need to do
python manage.py makemigrations
all the time because this command only creates migration files. (they are stored inyourproj/yourapp/migrations
) and does nothing towards the interaction with the real database. If you don't modify your project you don't actually need to re-create the migration files.