Skip to content

Commit

Permalink
Running migrations on start.
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Sargent committed Feb 3, 2024
1 parent 9b4ebfe commit b0778cc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@ name: Django CI

on:
push:
branches: [ master ]
branches: [main]
pull_request:
branches: [ master ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest
environment: test

strategy:
max-parallel: 4
matrix:
python-version: [2.7]
python-version: [3.11]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt --no-cache-dir
COPY . /code/
CMD gunicorn "approval_polls.wsgi:application" "-b 0.0.0.0:8000"
ENTRYPOINT ["/code/entrypoint.sh"]
13 changes: 13 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Exit script in case of error
set -e

# Run Django migrations
echo "Running migrations"
python manage.py migrate --noinput
python manage.py collectstatic --noinput

# Start Gunicorn server
echo "Starting server"
exec gunicorn "approval_polls.wsgi:application" "-b 0.0.0.0:8000"
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
asgiref==3.7.2 ; python_version >= "3.11" and python_version < "4.0"
django-environ==0.11.2 ; python_version >= "3.11" and python_version < "4"
django-extensions==3.2.3 ; python_version >= "3.11" and python_version < "4.0"
django-ipware==6.0.3 ; python_version >= "3.11" and python_version < "4.0"
django-registration-redux==2.13 ; python_version >= "3.11" and python_version < "4.0"
django-sendgrid-v5==1.2.3 ; python_version >= "3.11" and python_version < "4.0"
django-structlog==7.1.0 ; python_version >= "3.11" and python_version < "4.0"
django-upgrade==1.15.0 ; python_version >= "3.11" and python_version < "4.0"
django==5.0.1 ; python_version >= "3.11" and python_version < "4.0"
djangoajax==3.3 ; python_version >= "3.11" and python_version < "4.0"
gunicorn==21.2.0 ; python_version >= "3.11" and python_version < "4.0"
packaging==23.2 ; python_version >= "3.11" and python_version < "4.0"
python-http-client==3.3.7 ; python_version >= "3.11" and python_version < "4.0"
python-ipware==2.0.1 ; python_version >= "3.11" and python_version < "4.0"
pytz==2023.4 ; python_version >= "3.11" and python_version < "4.0"
sendgrid==6.11.0 ; python_version >= "3.11" and python_version < "4.0"
sqlparse==0.4.4 ; python_version >= "3.11" and python_version < "4.0"
starkbank-ecdsa==2.2.0 ; python_version >= "3.11" and python_version < "4.0"
structlog==24.1.0 ; python_version >= "3.11" and python_version < "4.0"
tokenize-rt==5.2.0 ; python_version >= "3.11" and python_version < "4.0"
tzdata==2023.4 ; python_version >= "3.11" and python_version < "4.0" and sys_platform == "win32"
whitenoise==6.6.0 ; python_version >= "3.11" and python_version < "4.0"

0 comments on commit b0778cc

Please sign in to comment.