From 79f5e17d388869b768b2eb2eee843a7486031743 Mon Sep 17 00:00:00 2001 From: Michael Hiiva Date: Thu, 18 Feb 2021 03:18:32 +0000 Subject: [PATCH 1/2] Removed alternative Docker for Python3.7. --- Dockerfile.python3 | 46 ------------------------------------ docker-compose-python3.yml | 48 -------------------------------------- 2 files changed, 94 deletions(-) delete mode 100644 Dockerfile.python3 delete mode 100644 docker-compose-python3.yml diff --git a/Dockerfile.python3 b/Dockerfile.python3 deleted file mode 100644 index 3a93b41b..00000000 --- a/Dockerfile.python3 +++ /dev/null @@ -1,46 +0,0 @@ -# Dockerfile for agagd application local development environment. -# -# In addition to environment variables used by the application, the entrypoint script is affected by the following. docker-compose.yml sets reasonable defaults for a development environment: -# * DB_HOST - database hostname -# * DB_PORT - database port -# * APP_DB_NAME - name of the database to use -# * AGAGD_USER - database username -# * MYSQL_PASSWORD - database password (the docker entrypoint sets MYSQL_PASS to this value for app compatibility) - -### Build stage, to avoid leaving dev dependencies in the final image -FROM python:3.7-slim AS build - -WORKDIR /build - -RUN apt-get update && apt-get install -y \ - libsqlite3-dev \ - libmariadb-dev \ - build-essential -RUN pip install --no-cache-dir -U pip - -COPY requirements.txt /build/ -RUN pip install --user --no-cache-dir -r requirements.txt && pip install --user --no-cache-dir uwsgi - -### Final image -FROM python:3.7-slim - -WORKDIR /srv -RUN useradd django - -COPY --from=build --chown=django:django /root/.local /home/django/.local - -RUN apt-get update && apt-get install -y \ - default-mysql-client \ - libmariadb3 - -USER django - -ENV PATH=/home/django/.local/bin:$PATH -ENV DJANGO_SETTINGS_MODULE=agagd.settings.prod -ENV PROJECT_ROOT=/srv -ENV TEMPLATE_DIR=/srv/templates - -COPY --chown=django:django scripts/ agagd/ /srv/ -RUN SECRET_KEY=stub-for-build python manage.py collectstatic --noinput - -CMD ["/srv/entrypoint.sh"] diff --git a/docker-compose-python3.yml b/docker-compose-python3.yml deleted file mode 100644 index a34543bc..00000000 --- a/docker-compose-python3.yml +++ /dev/null @@ -1,48 +0,0 @@ -# docker-compose setup for a development environment. -# To use this file, populate config-docker.env with the following: -# -# MYSQL_PASSWORD - a password for the mysql user -# MYSQL_ROOT_PASSWORD - a password for the mysql *root* user -# -# Then you can run: -# - docker-compose -f docker-compose-python3.yaml build -# - docker-compose -f docker-compose-python3.yaml up - -version: '3.5' - -services: - app: - build: - context: ./ - dockerfile: Dockerfile.python3 - restart: always - ports: - - "8000:3031" - environment: - DB_HOST: db - DB_PORT: 3306 - APP_DB_NAME: agagd - AGAGD_USER: agagd - MYSQL_PASSWORD: "${MYSQL_PASSWORD}" - SECRET_KEY: insecure-key-for-testing - DEBUG: "true" - LOAD_FIXTURES: "true" - - db: - build: - context: ./ - dockerfile: Dockerfile.mysql - restart: always - volumes: - - database:/var/lib/mysql - environment: - # this is safer than it looks, since without a 'ports' section, docker-compose - # isolates this app to a network local to this compose file. - MYSQL_ROOT_HOST: "%" - MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}" - MYSQL_USER: agagd - MYSQL_DATABASE: agagd - MYSQL_PASSWORD: "${MYSQL_PASSWORD}" - -volumes: - database: From 09aff3225e54bfb0307c9b28aaacd41f295e5e51 Mon Sep 17 00:00:00 2001 From: Michael Hiiva Date: Thu, 18 Feb 2021 03:26:24 +0000 Subject: [PATCH 2/2] Updated AGAGD to Python 3.7. --- Dockerfile | 4 ++-- agagd/agagd_core/models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb969d43..a29165b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ # * MYSQL_PASSWORD - database password (the docker entrypoint sets MYSQL_PASS to this value for app compatibility) ### Build stage, to avoid leaving dev dependencies in the final image -FROM python:2.7-slim AS build +FROM python:3.7-slim-buster AS build WORKDIR /build @@ -22,7 +22,7 @@ COPY requirements.txt /build/ RUN pip install --user --no-cache-dir -r requirements.txt && pip install --user --no-cache-dir uwsgi ### Final image -FROM python:2.7-slim +FROM python:3.7-slim-buster WORKDIR /srv RUN useradd django diff --git a/agagd/agagd_core/models.py b/agagd/agagd_core/models.py index 12827e2c..4236eb46 100644 --- a/agagd/agagd_core/models.py +++ b/agagd/agagd_core/models.py @@ -30,7 +30,7 @@ class Member(models.Model): renewal_due = models.CharField(max_length=255, blank=True) type = models.CharField(max_length=255, blank=True) - def __unicode__(self): + def __str__(self): return " %s (%s) " % (self.full_name, self.member_id, ) class Meta: