VibeLink - Share links to music with your friends once a day.
Create a env
directory with following dotenv files:
env/backend.env
DJANGO_SETTINGS_MODULE=core.settings.base
DEBUG=True
SECRET_KEY=randomsecretkey
ALLOWED_HOSTS=backend,localhost,127.0.0.1,host.docker.internal,*
FRONTEND_SITE_NAME=VibeLink
SIMPLE_JWT_AUDIENCE=vibelink
SIMPLE_JWT_ISSUER=vibelink
# default: 1 hour
SIMPLE_JWT_ACCESS_TOKEN_LIFETIME_SECONDS=3600
# default: 1 day
SIMPLE_JWT_REFRESH_TOKEN_LIFETIME_SECONDS=86400
DB_ENGINE=django.db.backends.postgresql
DB_NAME=postgres
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=postgres_db
DB_PORT=5432
REDIS_HOST=redis_db
REDIS_PORT=6379
USE_SMTP=True
EMAIL_HOST=...
EMAIL_PORT=...
EMAIL_HOST_USER=...
EMAIL_HOST_PASSWORD=...
EMAIL_USE_TLS=True
# Spotify API keys
# https://developer.spotify.com/dashboard
SPOTIPY_CLIENT_ID=...
SPOTIFT_CLIENT_SECRET=...
# Google API key
# https://console.cloud.google.com/apis/credentials
GOOGLE_CLOUD_API_KEY=...
env/postgres.env
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
env/redis.env
TZ=Europe/Warsaw
Create a virtual environment in the current directory and install dependencies:
mkdir .venv
pipenv shell
pipenv install
Set your Python interpreter to the one in the virtual environment.
Make sure Docker Engine is running.
While in root directory, build docker images and run them with docker-compose. This might take some time depending on your internet speed. Rebuilding image is crucial after installing new packages via pip.
docker compose build
To start containers run:
docker compose up
To stop containers run:
docker compose down
To run commands in an active container:
docker compose exec -it CONTAINER_NAME COMMAND
Prepare migrations (if there are any changes to db schema):
docker exec -it vibe-link-backend python manage.py makemigrations
Apply migrations:
docker exec -it vibe-link-backend python manage.py migrate
Create superuser:
docker exec -it vibe-link-backend python manage.py createsuperuser
To run an interactive python shell:
docker exec -it vibe-link-backend python manage.py shell_plus
To run unit tests:
docker exec -it vibe-link-backend coverage run manage.py test
To get coverage report from unit tests run:
docker exec -it vibe-link-backend coverage report -m