Built using React, [email protected], Bootstrap, Postgres, Django, Node, and Docker.
Setting Up Your Local Dev Environment.
- Clone and cd into TodoApp3
- Create a file named
.env
and fill in the following variables:
DEBUG=1
REGION=massachusetts
DJANGO_SUPERUSER_USERNAME=user1
DJANGO_SUPERUSER_PASSWORD=20Yearly22
[email protected]
DJANGO_SECRET_KEY=fix_this_later
POSTGRES_READY=0
POSTGRES_DB=dockerdc
POSTGRES_PASSWORD=mysecretpassword
POSTGRES_USER=myuser
POSTGRES_HOST=localhost
POSTGRES_PORT=5435
The app can be ran using Docker. We are currently running it using a docker-compose service.
- Once you have the above
.env
file, navigate to your project root (right wheredocker-compose.yaml
is) and run:
docker compose up -d
This will create a postgresql
database that's running in the container.
- Once that file is created, itβs time to build the image! That just takes a simple command invocation:
docker build -t dockernode .
-
Visit
http://localhost:8000/admin
in your browser to see the app and start using/developing. -
Next you need to make migrations and migrate them to the database. To do this, you need to first get in your docker container.
- Run
docker ps -a
ordocker images
or to list all the containers downloaded and their info.
-
When in your docker container, run the following commands. If you are on windows,use
python manage.py <command>
instad of./manage.py
. For the migrations on windows, you may need to do list all apps explicitly.- Run
./manage.py makemigrations
on mac to make all the migrations. - If you get a message output of 'no changes detected' that is fine and you can just run the next command.
- Run
./manage migrate
to migrate the changes. - More on django migrations and migrate here.
- Whenever you make a change to your models, please repeat steps 2 and 3.
- Run
-
To bring this database down just run:
docker compose down