From bf561613aa062c78778b2cb3cb2ff38fab468a74 Mon Sep 17 00:00:00 2001 From: Elijah Lucian Date: Thu, 15 Jul 2021 14:31:14 -0600 Subject: [PATCH] moved db file --- docker-compose.yml | 5 +++-- server/server/api/management/commands/seed.py | 22 ++++++++++++------- server/server/db/.keep | 0 server/server/settings.py | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 server/server/db/.keep diff --git a/docker-compose.yml b/docker-compose.yml index 82124ff..d0657c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,8 +28,9 @@ services: server: build: context: ./server - # volumes: - # - ./server:/usr/src/server + volumes: + - ./server/server/settings.py:/usr/src/server/server/settings.py + - ./server/server/db:/usr/src/server/server/db ports: - 8000:8000 command: ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/server/server/api/management/commands/seed.py b/server/server/api/management/commands/seed.py index 05dcbe8..2df1897 100644 --- a/server/server/api/management/commands/seed.py +++ b/server/server/api/management/commands/seed.py @@ -1,6 +1,6 @@ -from server.server.api.models import Transaction +from server.server.api.models import Transaction, Account, User, Stack from django.core.management.base import BaseCommand -import random + class Command(BaseCommand): help = "Seed database for dev" @@ -9,21 +9,27 @@ class Command(BaseCommand): self.stdout.write('clearing and seeding database...') User.objects.all().delete() - # create seed users - # - elijah / toffee15 - # - toffee / toffee15 + elijah = User(username="elijah", + email="elijah@westwinds.io", + password="toffee15") + ievgen = User(username="ievgen", + email="ievgen@westwinds.io", + password="toffee15") + tanner = User(username="tanner", + email="tanner@westwinds.io", + password="toffee15") Account.objects.all().delete() + home = Account() # create seed accounts # Home Account - # $3000 + # $3000 # - home expenses Stack.objects.all().delete() # create test stacks # - name: shit - Transaction.objects.all().delete() # generate transaction history - self.stdout.write('done!') \ No newline at end of file + self.stdout.write('done!') diff --git a/server/server/db/.keep b/server/server/db/.keep new file mode 100644 index 0000000..e69de29 diff --git a/server/server/settings.py b/server/server/settings.py index dd9c468..e511bd8 100644 --- a/server/server/settings.py +++ b/server/server/settings.py @@ -96,7 +96,7 @@ WSGI_APPLICATION = 'server.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'NAME': BASE_DIR / 'server/db/db.sqlite3', } }