diff --git a/Dockerfile b/Dockerfile index 2173071..5e3a243 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,8 @@ RUN apt-get update && apt-get -y install \ && apt-get clean RUN pip install --no-cache-dir \ - celery==3.1.17 \ - Django==1.8.18 \ + celery==3.1.26.post2 \ + Django==1.11.16 \ django-celery \ envparse \ gevent \ diff --git a/docker-compose.yml b/docker-compose.yml index 666cb80..82d2ae4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: django: - image: gohitech/django:djcelery + image: monashmerc/django:djcelery-dj1.11 build: . environment: - DJANGO_ADMINS=[('John', 'john@example.com'), ('Mary', 'mary@example.com')] @@ -15,7 +15,7 @@ services: volumes: - ./share:/share celery: - image: gohitech/django:djcelery + image: monashmerc/django:djcelery-dj1.11 command: --loglevel=INFO --autoreload environment: - CELERY_ENABLE=True @@ -23,7 +23,7 @@ services: links: - db beat: - image: gohitech/django:djcelery + image: monashmerc/django:djcelery-dj1.11 command: --loglevel=INFO environment: - CELERY_ENABLE=beat @@ -31,7 +31,7 @@ services: links: - db other: - image: gohitech/django:djcelery + image: monashmerc/django:djcelery-dj1.11 command: ["tail","-f","/dev/null",] environment: - GUNICORN_ENABLE=False diff --git a/settings.py b/settings.py index 93daea3..f3ca2d1 100644 --- a/settings.py +++ b/settings.py @@ -1,16 +1,16 @@ """ Django settings for Docker image. -Derived from settings generated by 'django-admin startproject' using Django 1.8.18. +Generated by 'django-admin startproject' using Django 1.11.16. For more information on this file, see -https://docs.djangoproject.com/en/1.8/topics/settings/ +https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.8/ref/settings/ +https://docs.djangoproject.com/en/1.11/ref/settings/ """ # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ import sys import socket @@ -26,7 +26,7 @@ import djcelery try: - from settings_pre import * + from settings_pre import * # pylint: disable=wildcard-import,unused-wildcard-import except ImportError: pass @@ -48,7 +48,9 @@ def _gethostbyname(hostname): # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', '+hzj(tw!bod_*_xh4u2ml!ylbtx6)2r9bqq2i!evjo!x&pay%2') -# https://docs.djangoproject.com/en/1.8/howto/static-files/ +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.11/howto/static-files/ + STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, "static") @@ -58,19 +60,19 @@ def _gethostbyname(hostname): # Get all Environment variables with a DJANGO_ prefix; remove prefix -#print { k: v for k, v in os.environ.iteritems() if k.startswith('DJANGO_') } -_django_environ = { k[7:]: v for k, v in os.environ.iteritems() if k.startswith('DJANGO_') } +#print {k: v for k, v in os.environ.iteritems() if k.startswith('DJANGO_')} +_django_environ = {k[7:]: v for k, v in os.environ.iteritems() if k.startswith('DJANGO_')} for key in _django_environ: try: - if (key in {'PROJECT_NAME','SETTINGS_MODULE',}) or (key.startswith('DATABASE_')): + if (key in {'PROJECT_NAME', 'SETTINGS_MODULE',}) or (key.startswith('DATABASE_')): pass - elif key in {'ADMINS','MANAGERS',}: + elif key in {'ADMINS', 'MANAGERS',}: setattr(this_module, key, tuple(literal_eval(_django_environ[key]))) else: setattr(this_module, key, literal_eval(_django_environ[key])) - except ValueError,e: + except ValueError as err: setattr(this_module, key, _django_environ[key]) - #print "ValueError for %s: %s (%s)" % (key,_django_environ[key],str(e)) + #print "ValueError for %s: %s (%s)" % (key,_django_environ[key],str(err)) # Logging @@ -86,7 +88,7 @@ def _gethostbyname(hostname): 'loggers': { 'django': { 'handlers': ['console',], - 'level': os.getenv('DJANGO_LOG_LEVEL','INFO'), + 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'), }, }, } @@ -103,7 +105,7 @@ def _gethostbyname(hostname): ) INSTALLED_APPS += ("djcelery", ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -131,16 +133,16 @@ def _gethostbyname(hostname): ] # CACHES and Database -# https://docs.djangoproject.com/en/1.8/topics/cache/ -# https://docs.djangoproject.com/en/1.8/ref/settings/#databases +# https://docs.djangoproject.com/en/1.11/topics/cache/ +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases # https://hub.docker.com/_/postgres/ if _gethostbyname('db') and os.getenv('POSTGRES_PASSWORD') is not None: if os.getenv('POSTGRES_PASSWORD') is not None: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': os.getenv('POSTGRES_DB', os.getenv('POSTGRES_USER','postgres')), - 'USER': os.getenv('POSTGRES_USER','postgres'), + 'NAME': os.getenv('POSTGRES_DB', os.getenv('POSTGRES_USER', 'postgres')), + 'USER': os.getenv('POSTGRES_USER', 'postgres'), 'PASSWORD': os.getenv('POSTGRES_PASSWORD'), 'HOST': 'db', 'PORT': '5432', @@ -176,13 +178,13 @@ def _gethostbyname(hostname): """ # Provide overrides in settings.d/*.py -config_files = glob.glob(os.path.join(os.getenv('DJANGO_PROJECT_NAME', 'gohitech'),'settings.d','*.py')) -#config_files = glob.glob(os.path.join(BASE_DIR,'settings.d','*.py')) +config_files = glob.glob(os.path.join(os.getenv('DJANGO_PROJECT_NAME', 'gohitech'), 'settings.d', '*.py')) +#config_files = glob.glob(os.path.join(BASE_DIR, 'settings.d', '*.py')) try: for config_f in sorted(config_files): print "INFO: Execute config file %s" % os.path.abspath(config_f) execfile(os.path.abspath(config_f)) -except TypeError,e: +except TypeError: pass print "djcelery.setup_loader()"