Reputation: 170
i develope a django project on my local system, and now i deployed that to a server.
i used MySql as database. whenever i try to migrate my models (using python manage.py migrate
or python manage.py makemigrations
) to server's new database, it shows me following error:
django.db.utils.ProgrammingError: (1146, "Table '<DB_NAME>.mainapp_service' doesn't exist")
and doesn't create tables into the database.
i didn't move any of my local migration
files to server, just moved mainapp/migrations/__init__.py
file.
how can i create all tables and run my app?
Upvotes: 1
Views: 2293
Reputation: 638
You really shouldn't run makemigrations
on the server. You should include migrations in version control and push your migrations files to the server and then run migrate
. Make sure you have created the database on the server and that you have it confugured in settings.py. Check out the Workflow section on migrations.
Upvotes: 2