Boiler plate code to get started on full stack applications fast. Includes auth, basic models, and protected routes.
- Install docker and docker-compose
The docker software can be downloaded here: https://www.docker.com/products/docker-desktop/
To install docker-compose on Linux:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
check installation
docker-compose --version
- Clone this repository.
- Create an
.env
file in the backend directory withtouch .env
Some typical backend environment variables could be:
SECRET_KEY=your_secret_key
DEBUG=True
DB_NAME=mydatabase
DB_USER=myuser
DB_PASSWORD=mypassword
DB_HOST=db
DB_PORT=5432
- Create an
.env
file in the frontend directort withtouch .env
Some typical frontend environment variables could be:
REACT_APP_API_URL="http://127.0.0.1:8000"
NODE_ENV=development
- Build the docker image. You may need to add
sudo
on Linux.
docker-compose build
- Start the docker container. (again, you may need
sudo
for Linux)
docker-compose up
- In another terminal window, but while the first one is still running, make migrations and migrate. (if you're on Linux and you've gotten to this point do I really need to mention
sudo
?)
docker-compose exec web python manage.py makemigrations
docker-compose exec web python manage.py migrate
- Seed the db (if seed data exists)
docker-compose exec web python manage.py loaddata seed_data.json
- Create a superuser
docker-compose exec web python manage.py createsuperuser
- Collect static files (css, js, images)
docker-compose exec web python manage.py collectstatic
NOTE The homepage is protected by default. This is just so that there's something there. So you will get a 404 when the dev server starts the first time.