diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index eb741d9..8f4446c 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index b4d57a3..765522d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" \ No newline at end of file +ENTRYPOINT ["/code/entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..3f19107 --- /dev/null +++ b/entrypoint.sh @@ -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" diff --git a/requirements.txt b/requirements.txt index 6c16a4b..e365a27 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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"