Managing the Django Sqlite development db with respect to Git

222 views
Skip to first unread message

cortez

unread,
Feb 25, 2016, 12:12:10 PM2/25/16
to Django users
Hi,

I'm using the out-of-the-box Sqlite database integration with my Django project, and I'm wondering how to manage it with respect to Git. Currently I have it checked in, but I suspect this isn't what I want to be doing. Also I have noticed that every time I log in to the admin interface and view a record Git tells me that the .db file has changed, even if I make no changes to the record itself... not sure what's going on there.

So I want to add the database under my .gitignore, but I don't what the best practices are with respect to maintaining my project database outside of Git. I guess I could just dump it to JSON using dumpdata and check that in, but that still seems a bit cumbersome. Do people do that? I don't know what alternatives there are to that. Is there any kind of Django extension available for this?

Any advice very much appreciated.

C

Rafael E. Ferrero

unread,
Feb 25, 2016, 1:19:20 PM2/25/16
to django...@googlegroups.com
I put my sqlite files into .gitignore.


Rafael E. Ferrero

--
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...@googlegroups.com.
To post to this group, send email to django...@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/403b06ed-1a7b-4a9b-9534-ba011b615090%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Roseman

unread,
Feb 25, 2016, 1:25:47 PM2/25/16
to Django users
Why do you want your db in version control at all? There is not normally a good reason to do that.
--
DR.

cortez

unread,
Feb 25, 2016, 2:23:57 PM2/25/16
to Django users
Well I don't, but I'm not sure what the alternatives are. I mean what I'm interested in are alternatives to keeping it under version control, so I have backups, history, versioning. Preferably something I can easily integrate with my Django workflow, without having to manually keep external copies.

Alex M

unread,
Feb 25, 2016, 2:33:06 PM2/25/16
to django...@googlegroups.com
Normally for a site you don't keep your db in version control because
the table definitions come from Django. Now if you have data to
prepopulate (each time you fresh clone) or need to do a backup then use
standard db backup mechanisms.

Like dumping your db to an sql backup. It's not efficient to do this in
plain text but you could if the data is small, and that could go in
version control. I suppose creating db backups is more common in service
based dbs (mysql, postgres, etc).

As for the history, versioning etc, of the db, just look at normal
backup workflows and get used to that the db data is separate from the
Django code.

Enjoy,
Alex

On 02/25/2016 11:23 AM, cortez wrote:
> Well I don't, but I'm not sure what the alternatives are. I mean what I'm
> interested in are *alternatives* to keeping it under version control, so I

cortez

unread,
Feb 25, 2016, 2:47:56 PM2/25/16
to Django users, te...@wildintellect.com
Thanks Alex, that's great information, I shall dig in.

C
Reply all
Reply to author
Forward
0 new messages