#proper backup solution

15 messages · Page 1 of 1 (latest)

mighty knoll
#

What is the preferred method/script to backup (and safely restore!) db+migrationdb+migrations so I can experiment with migrations?
(Trying to fix a problematic migration resulting in E304 (not my code))

upbeat wave
mighty knoll
#

Thank you, but I am using MariaDB. My question is not specific about databases (those are indeed quite covered) but I am looking for a total solution: django/migration stuff included.

tepid basin
#

To backup your db, use something like mysqldump. This will include the migration records, since they are just another database table. The migration files themselves should be part of your code, i.e. they should be under version control.

mighty knoll
#

It is not my code. I was hoping for a python script which would use settings.py so the db access/rights are also taken care of.

upbeat wave
#

but if you want something from django itself, you can use fixtures

#

disable your signals when exporting your db or you'll have somo troubles

tepid basin
tepid basin
mighty knoll
#

The idea was/is to write a plain python script within the virtenv but separate from Django and use import django.conf to parse the database settings, but that does sound more trivial than it is. So far I have not seen loading of settings.py or an indication on where my script (directory) must run so 'from django.conf import settings' will give me access to the db credentials. Of course i can grep or use a regex to parse the file, but I try to do it more pyonic

#

I assume it has to run from the same dir as settings.py is located, but if I run it from a higher level it does not error when importing.
All docs assume importing from within a django environment

#

As far as I can tell. The idea is quite basic, but I found no examples how to do something similar so far.

inland spindle
#

Why bother with python if there is db tool?