moved db file

This commit is contained in:
Elijah Lucian 2021-07-15 14:31:14 -06:00
parent 8e7fc05cd1
commit bf561613aa
4 changed files with 18 additions and 11 deletions

View File

@ -28,8 +28,9 @@ services:
server: server:
build: build:
context: ./server context: ./server
# volumes: volumes:
# - ./server:/usr/src/server - ./server/server/settings.py:/usr/src/server/server/settings.py
- ./server/server/db:/usr/src/server/server/db
ports: ports:
- 8000:8000 - 8000:8000
command: ["python", "manage.py", "runserver", "0.0.0.0:8000"] command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]

View File

@ -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 from django.core.management.base import BaseCommand
import random
class Command(BaseCommand): class Command(BaseCommand):
help = "Seed database for dev" help = "Seed database for dev"
@ -9,21 +9,27 @@ class Command(BaseCommand):
self.stdout.write('clearing and seeding database...') self.stdout.write('clearing and seeding database...')
User.objects.all().delete() User.objects.all().delete()
# create seed users elijah = User(username="elijah",
# - elijah / toffee15 email="elijah@westwinds.io",
# - toffee / toffee15 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() Account.objects.all().delete()
home = Account()
# create seed accounts # create seed accounts
# Home Account # Home Account
# $3000 # $3000
# - home expenses # - home expenses
Stack.objects.all().delete() Stack.objects.all().delete()
# create test stacks # create test stacks
# - name: shit # - name: shit
Transaction.objects.all().delete() Transaction.objects.all().delete()
# generate transaction history # generate transaction history
self.stdout.write('done!') self.stdout.write('done!')

0
server/server/db/.keep Normal file
View File

View File

@ -96,7 +96,7 @@ WSGI_APPLICATION = 'server.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3', 'NAME': BASE_DIR / 'server/db/db.sqlite3',
} }
} }