On 13/02/2018 11:09 AM, Tom Tanner wrote:
I have a Django project that I want to work on with another computer. Do I need to backup my current project's Postgres database and restore it on the other computer's Postgres database to get my project up and running there? Or is there a Django way to do this?

There are at least two simple ways to do this. Both need a repo to keep your source code and requirements file (eg freeze.txt) in sync between your machines. Both need to run pip -r freeze.txt each time it changes.

1. Dump the "master" database into a text file, copy it to the "slave" machine and load it there. Obviously you can do this in both directions. You can use bash scripts or Windows batch files. Risk of human error in overwriting the wrong database is a constant possibility.

2. Establish your current Postgres as a more widely accessible server which can be seen from the slave machine. A bonus here is that migrations can be done from either machine and the database can never get out of sync. Every database dump is a backup if you include a date in the filename. And it can be dumped from either machine.

In both cases you will need to manage database credentials using identical source code in your settings. This is because after you merge your source from machine to machine in either direction the Django settings need to see the database. But that's a separate question.

hth

Mike




--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5ab2022-4fd1-4f8f-bb40-d4194bbf397f%40googlegroups.com <https://groups.google.com/d/msgid/django-users/b5ab2022-4fd1-4f8f-bb40-d4194bbf397f%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3054a69b-214a-c522-7e12-051e35d89e0d%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to