Skip to content

Update settings.py

Update settings.py #12

name: Django Deployment Workflow
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Change file owner
run: |
sudo chown -R $(id -u):$(id -g) ../../
- name: Check if folder exists
run: |
echo "Create if dosen't exist /var/www/${{ github.event.repository.name }}"
sudo mkdir -p /var/www/${{ github.event.repository.name }}/static
- name: Checkout code
uses: actions/checkout@v2
with:
path: 'prod/'
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build Docker Images
run: |
cd prod
cp ../../.env .
docker-compose -f docker-compose.prod.yml build
docker-compose -f docker-compose.prod.yml run backend python manage.py check --deploy
docker-compose -f docker-compose.prod.yml run backend python manage.py migrate
docker-compose -f docker-compose.prod.yml run backend python manage.py createsuperuser --noinput 2> /dev/null || true
docker-compose -f docker-compose.prod.yml run backend python manage.py collectstatic --no-input
- name: Run tests
run: |
cd prod
# docker-compose -f docker-compose.prod.yml run backend python manage.py test
- name: Run Deployment commands
run: |
cd prod
docker-compose -f docker-compose.prod.yml up --build -d