From 6a968e8aa1e82cb862e9a77ca8f2de0234cb9eda Mon Sep 17 00:00:00 2001 From: Jonathan Grochowski Date: Tue, 4 Aug 2020 10:51:21 -0700 Subject: [PATCH] Implement changes necessary to run under Docker Using (https://github.com/gpodder/mygpo/pull/32) and (https://github.com/gpodder/mygpo/pull/397) as a starting point, we implement some changes to get mygpo to run correctly under Docker. To actually make use of this, we need an as-yet-unpublished `Dockerfile` and `docker-compose.yaml`. --- mygpo/locale/fr/LC_MESSAGES/django.po | 2 +- mygpo/settings.py | 3 ++- mygpo/users/checks.py | 4 ++-- requirements.txt | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mygpo/locale/fr/LC_MESSAGES/django.po b/mygpo/locale/fr/LC_MESSAGES/django.po index e968b0862..257bc6c64 100644 --- a/mygpo/locale/fr/LC_MESSAGES/django.po +++ b/mygpo/locale/fr/LC_MESSAGES/django.po @@ -813,7 +813,7 @@ msgstr "Podcast inconnu" #: mygpo/podcasts/models.py:700 #, python-brace-format msgid "Unknown Podcast from {domain}" -msgstr "Podcast inconnu de {domaine}" +msgstr "Podcast inconnu de {domain}" #: mygpo/podcasts/templates/episode.html:85 #: mygpo/podcasts/templates/episodes.html:27 diff --git a/mygpo/settings.py b/mygpo/settings.py index 9a662e4b5..776aa972a 100644 --- a/mygpo/settings.py +++ b/mygpo/settings.py @@ -85,7 +85,7 @@ def get_intOrNone(name, default): # Static Files -STATIC_ROOT = 'staticfiles' +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = '/static/' STATICFILES_DIRS = (os.path.abspath(os.path.join(BASE_DIR, '..', 'static')),) @@ -137,6 +137,7 @@ def get_intOrNone(name, default): MIDDLEWARE = [ + 'whitenoise.middleware.WhiteNoiseMiddelware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/mygpo/users/checks.py b/mygpo/users/checks.py index c67013869..26624eb38 100644 --- a/mygpo/users/checks.py +++ b/mygpo/users/checks.py @@ -29,8 +29,8 @@ def check_case_insensitive_users(app_configs=None, **kwargs): wid = 'users.W001' errors.append(Warning(txt, id=wid)) - except OperationalError as oe: - if 'no such table: auth_user' in str(oe): + except (OperationalError, ProgrammingError) as oe: + if 'no such table: auth_user' in str(oe) or 'relation "auth_user" does not exist' in str(oe): # Ignore if the table does not yet exist, eg when initally # running ``manage.py migrate`` pass diff --git a/requirements.txt b/requirements.txt index 9f1d550db..9b576ccae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,3 +17,4 @@ django-celery-results==1.2.1 django-celery-beat==2.0.0 requests==2.24.0 django-db-geventpool==3.2.2 +whitenoise==5.0.1