gitignoring .sqlite3 files

I am working on a website for selling cakes. I am using django , I don’t have much to ask for now jsut one simple question. Should I gitignore the .sqlite3 files ?

That depends upon how you’re going to deploy your application and/or whether you want to keep a safe copy of your test data in your repo.

I’ve got a couple of projects where the production database is using sqlite. The skeleton database is stored in git since it’s part of the deployment environment.

I was planning on saving the skeleton too. But I don’t want to save the user data in github.

One of the easiest ways around that would be to store the database outside the directory of your project. There’s no requirement that the sqlite files be in any specific location. The defaults created by startproject are just that - defaults. They’re not requirements.

1 Like

But I was thinking about collaborating with some other people. Any ideas for that.

Ideas for what? I’m not sure what you’re looking for here.

Well maybe I should setup a server. That would be better to store the data

What @KenWhitesell was explaining is that django stores data relating to your website on a database. It has to store data somewhere. By default, django uses SQLite. I presume you are concerned about sending your sqlite files to github/gitlab (repo). You can gitignore the sqlite file but you definitely want to preserve your migrations. Those collaborating with you can contribute with a private/personal Sqlite database.

It starts to become involving when you need dedicated database servers (Mariadb/MySQL, Postgresql etc.) Since you are not going there yet … its okay to gitignore the sqlite file. Some teams don’t mind sending their SQLite database to git especially when there is nothing sensitive there (or the project is not public) – the added advantage is that team members use the same database for their testing/development.

1 Like