[Answered ]-Separate databases for development and production in Djang

0👍

Found the solution in this post

Apparently, Django tries to evaluate all queries declared on class level before running the migration. This causes an error because the database is empty, and the query can not run.

To solve this, comment out everything in the main urls.py, so that there are no imports and urlpatterns. Then run python manage.py makemigrations and after it has completed, revert the urls.py to the original.

👤Basley

1👍

If you have a new empty database, you can just run "python manage.py migrate" and all migrations will be executed on the new database. The already done migrations will be stored in a table in that database so that django always "remembers" the migrations state of each individual database. Of course that new database will only have the tables structure – there is not yet any data copied!
Does this answer your question?

Leave a comment