Skip to content

Commit

Permalink
Merge pull request #6 from digorgonzola/django_upgrade
Browse files Browse the repository at this point in the history
Django upgrade
  • Loading branch information
digorgonzola authored Nov 21, 2023
2 parents ab3eaa8 + 68e6a45 commit 346fa27
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 29 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
FROM python:3.7-alpine
FROM python:3.10
LABEL maintainer="[email protected]"

ARG USER_ID=1000

ENV PYTHONUNBUFFERED 1
ENV PIP_ROOT_USER_ACTION=ignore
ENV PATH="/scripts:${PATH}"

COPY ./requirements.txt /requirements.txt
RUN apk add --update --no-cache postgresql-client jpeg-dev
RUN apk add --update --no-cache --virtual .tmp-build-deps \
gcc libc-dev linux-headers postgresql-dev musl-dev zlib zlib-dev
RUN pip install -r /requirements.txt
RUN apk del .tmp-build-deps

RUN mkdir /app
WORKDIR /app
Expand All @@ -19,7 +18,7 @@ RUN chmod +x /scripts/*

RUN mkdir -p /vol/web/media
RUN mkdir -p /vol/web/static
RUN adduser -D user
RUN adduser --uid $USER_ID user
RUN chown -R user:user /vol/
RUN chmod -R 755 /vol/web
USER user
Expand Down
5 changes: 2 additions & 3 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

Expand All @@ -41,8 +40,9 @@
)
)

# Application definition
DEFAULT_AUTO_FIELD='django.db.models.AutoField'

# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
Expand Down Expand Up @@ -132,7 +132,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

Expand Down
2 changes: 1 addition & 1 deletion app/user/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from rest_framework import serializers

Expand Down
1 change: 1 addition & 0 deletions docker-compose-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
context: .
healthcheck:
test: ["CMD-SHELL", "uwsgi-is-ready --stats-socket /tmp/statsock > /dev/null 2>&1 || exit 1"]
image: api
volumes:
- ./app:/app
- static_data:/vol/web
Expand Down
5 changes: 2 additions & 3 deletions docker-compose-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ services:
app:
build:
context: .
healthcheck:
test: ["CMD-SHELL", "uwsgi-is-ready --stats-socket /tmp/statsock > /dev/null 2>&1 || exit 1"]
image: api
ports:
- "8000:8000"
volumes:
Expand Down Expand Up @@ -46,7 +45,7 @@ services:
"
db:
image: postgres:10-alpine
image: postgres:12-alpine
environment:
- POSTGRES_DB=app
- POSTGRES_USER=postgres
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ services:
app:
build:
context: .
healthcheck:
test: ["CMD-SHELL", "uwsgi-is-ready --stats-socket /tmp/statsock > /dev/null 2>&1 || exit 1"]
image: api
ports:
- "8000:8000"
volumes:
Expand All @@ -26,7 +25,7 @@ services:
condition: service_healthy

db:
image: postgres:10-alpine
image: postgres:12-alpine
environment:
- POSTGRES_DB=app
- POSTGRES_USER=postgres
Expand Down
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
boto3>=1.12.0,<1.13.0
Django>=2.1.3,<2.2.0
djangorestframework>=3.9.0,<3.10.0
django-allow-cidr>=0.3.1,<0.4.0
django-storages>=1.9.1,<1.10.0
psycopg2>=2.7.5,<2.8.0
Pillow>=5.3.0,<5.4.0
uwsgi>=2.0.18,<2.1.0
flake8>=3.6.0,<3.7.0
uwsgi-readiness-check
boto3>=1.29.4,<1.30.0
Django>=4.2.7,<4.3.0
djangorestframework>=3.14.0,<3.15.0
django-allow-cidr>=0.7.1,<0.8.0
django-storages>=1.14.2,<1.15.0
psycopg2>=2.9.9,<2.10.0
Pillow>=10.1.0,<10.2.0
uwsgi>=2.0.23,<2.1.0
flake8>=6.1.0,<6.2.0
uwsgi-readiness-check>=0.2.0,<0.3.0
18 changes: 15 additions & 3 deletions tests/config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
schemaVersion: 2.0.0

commandTests:
- name: check psql is installed
command: psql
args: ["--version"]
- name: check boto3 is installed
command: pip
args: [ "show", "-q", "boto3" ]
exitCode: 0
- name: check django is installed
command: pip
Expand All @@ -13,6 +13,14 @@ commandTests:
command: pip
args: ["show", "-q", "djangorestframework"]
exitCode: 0
- name: check django-allow-cidr is installed
command: pip
args: ["show", "-q", "django-allow-cidr"]
exitCode: 0
- name: check django-storages is installed
command: pip
args: ["show", "-q", "django-storages"]
exitCode: 0
- name: check psycopg2 is installed
command: pip
args: ["show", "-q", "psycopg2"]
Expand All @@ -29,6 +37,10 @@ commandTests:
command: pip
args: ["show", "-q", "flake8"]
exitCode: 0
- name: check uwsgi-readiness-check is installed
command: pip
args: ["show", "-q", "uwsgi-readiness-check"]
exitCode: 0

fileExistenceTests:
- name: entrypoint
Expand Down

0 comments on commit 346fa27

Please sign in to comment.