How do I restore a Django project using the pg_dump file?

What is the procedure for restoring a Django project using an already restored database from PostgreSQL pg_dump. There is also the django source code. Is porting Django safe?

+3


source to share


1 answer


If your dump has generated table statements and contains all django tables, you can restore it directly to an empty database. Django will know the migration status as they are stored in a table in the database.

So the steps:



  • Rollback and restore the database.

    If you now run python manage.py showmigrations all migrations will appear unapplied

  • Recover DB from dump

    If you now run python manage.py showmigrations, the corresponding migrations will appear. If your django project has new migrations that were not applied when the dump was generated, they will appear unapplied.

And this! You can now apply the new migrations, if any, and continue working on your Django project.

+1


source







All Articles