From 68bee526b9f38dd13985407c33501f72b832fbb2 Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Sat, 15 Jul 2023 00:14:00 +0100 Subject: [PATCH] Use sqlite database in production Before now, we've been using a postgres database to store the data in production. It's not worth the maintenance cost. This changes the start-up script we use in production to create and populate an SQLite file before we start the server process. We probably don't need to take the step of removing the sqlite file, but I'm not sure if it might already exist from previous builds in prod. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ac63baa1..25b919fa 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ mypy: build: pip install -r requirements.txt python manage.py collectstatic --no-input + rm --force ccbv.sqlite + DATABASE_URL=sqlite:///ccbv.sqlite python manage.py migrate + DATABASE_URL=sqlite:///ccbv.sqlite python manage.py loaddata $(shell find cbv/fixtures -name '*.json' | xargs) run-prod: - gunicorn core.wsgi --log-file - + DATABASE_URL=sqlite:///ccbv.sqlite gunicorn core.wsgi --log-file -