57 changes: 57 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

version: '2'

services:

postgres:
build:
context: contrib
dockerfile: Dockerfile.postgres
environment:
POSTGRES_HOST_AUTH_METHOD: 'trust'

memcached:
image: memcached:1.4

redis:
image: redis:3.2-alpine

web:
extends:
file: docker-compose-common.yml
service: base
links:
- redis
- postgres
- memcached
ports:
- '8000:8000'
depends_on:
- postgres
- redis

worker:
extends:
file: docker-compose-common.yml
service: base
command: /srv/mygpo/contrib/wait-for-postgres.py celery -A mygpo worker --concurrency=3 -l info -Ofair
links:
- web
- postgres
- redis
depends_on:
- postgres
- redis

beat:
extends:
file: docker-compose-common.yml
service: base
command: /srv/mygpo/contrib/wait-for-postgres.py celery -A mygpo beat --pidfile /tmp/celerybeat.pid -S django
links:
- web
- postgres
- redis
depends_on:
- postgres
- redis
10 changes: 9 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
APT=sudo apt-get

all: help

help:
Expand Down Expand Up @@ -34,9 +36,15 @@ clean:
git clean -fX

install-deps:
sudo apt-get install libpq-dev libjpeg-dev zlib1g-dev libwebp-dev \
$(APT) install libpq-dev libjpeg-dev zlib1g-dev libwebp-dev gettext \
build-essential python3-dev virtualenv libffi-dev redis postgresql

docker-build:
sudo docker build -t="mygpo/web" .

docker-run:
sudo docker run --rm -p 8000:8000 --name web --link db:db -e SECRET_KEY=asdf mygpo/web

format-code:
black --target-version py36 --skip-string-normalization mygpo/

Expand Down
2 changes: 1 addition & 1 deletion mygpo/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions mygpo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_intOrNone(name, default):

DEBUG = get_bool('DEBUG', False)


ADMINS = re.findall(r'\s*([^<]+) <([^>]+)>\s*', os.getenv('ADMINS', ''))

MANAGERS = ADMINS
Expand Down Expand Up @@ -85,7 +86,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')),)
Expand Down Expand Up @@ -137,6 +138,7 @@ def get_intOrNone(name, default):


MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down Expand Up @@ -185,6 +187,7 @@ def get_intOrNone(name, default):
'mygpo.votes',
]


try:
if DEBUG:
import debug_toolbar
Expand All @@ -208,6 +211,7 @@ def get_intOrNone(name, default):

ACCOUNT_ACTIVATION_DAYS = int(os.getenv('ACCOUNT_ACTIVATION_DAYS', 7))


AUTHENTICATION_BACKENDS = (
'mygpo.users.backend.CaseInsensitiveModelBackend',
'mygpo.web.auth.EmailAuthenticationBackend',
Expand All @@ -229,7 +233,6 @@ def get_intOrNone(name, default):

CSRF_FAILURE_VIEW = 'mygpo.web.views.csrf_failure'


DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', '')

SERVER_EMAIL = os.getenv('SERVER_EMAIL', DEFAULT_FROM_EMAIL)
Expand All @@ -241,12 +244,15 @@ def get_intOrNone(name, default):

GOOGLE_ANALYTICS_PROPERTY_ID = os.getenv('GOOGLE_ANALYTICS_PROPERTY_ID', '')


DIRECTORY_EXCLUDED_TAGS = os.getenv('DIRECTORY_EXCLUDED_TAGS', '').split()


FLICKR_API_KEY = os.getenv('FLICKR_API_KEY', '')

SOUNDCLOUD_CONSUMER_KEY = os.getenv('SOUNDCLOUD_CONSUMER_KEY', '')


MAINTENANCE = get_bool('MAINTENANCE', False)


Expand Down
6 changes: 4 additions & 2 deletions mygpo/users/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ 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
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ redis==3.3.11
django-celery-results==1.2.0
django-celery-beat==1.5.0
requests==2.22.0
whitenoise==5.0.1
django-db-geventpool==3.1.0