Commit 821beadb authored by isillitoe's avatar isillitoe
Browse files

add docs

parent 81c80c01
"""
Run tasks in the background with Celery
"""
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
......@@ -29,4 +29,5 @@ app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
@app.task(bind=True)
def debug_task(self):
"""Print debug messages"""
print('Request: {0!r}'.format(self.request))
......@@ -5,51 +5,60 @@ from decouple import config
from .base import *
# Bend the broker to the redis container
BROKER_URL = 'redis://cathapi-redis:6379'
CELERY_RESULT_BACKEND = 'redis://cathapi-redis:6379'
# These settings make sure any tasks run in testing
# are run locally with the 'test' database
CELERY_ALWAYS_EAGER = True
TEST_RUNNER = 'djcelery.contrib.test_runner.CeleryTestSuiteRunner'
IS_CELERY = config('I_AM_CELERY', default=False, cast=bool)
if not IS_CELERY:
# These settings are only relevant for Django instances
DEBUG = True
# Bend the Django cache to use the redis container
CACHES["default"]["LOCATION"] = "redis://cathapi-redis:6379/1"
'''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config('PG_NAME', default='cathapi', cast=str),
'USER': config('PG_USER', default='cathapiuser', cast=str),
'PASSWORD': config('POSTGRES_PASSWORD', cast=str),
'HOST': config('PG_HOST', default='postgres', cast=str),
'PORT': config('PG_PORT', default=5432, cast=int),
}
}
'''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join('/cathapi-data', 'db.sqlite3'),
}
}
INSTALLED_APPS += [
# 'debug_toolbar',
]
STATICFILES_DIRS = [
os.path.join('static/'),
]
STATIC_ROOT = '/static'
#MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
# These settings are only relevant for Django instances
DEBUG = True
# Bend the Django cache to use the redis container
CACHES["default"]["LOCATION"] = "redis://cathapi-redis:6379/1"
'''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config('PG_NAME', default='cathapi', cast=str),
'USER': config('PG_USER', default='cathapiuser', cast=str),
'PASSWORD': config('POSTGRES_PASSWORD', cast=str),
'HOST': config('PG_HOST', default='postgres', cast=str),
'PORT': config('PG_PORT', default=5432, cast=int),
}
}
'''
# local database config
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join('/cathapi-data', 'db.sqlite3'),
}
}
INSTALLED_APPS += [
# 'debug_toolbar',
]
STATICFILES_DIRS = [
os.path.join('static/'),
]
STATIC_ROOT = '/static'
#MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
......@@ -4,8 +4,12 @@ from decouple import config
from .base import *
# turn off debug
DEBUG = False
# use PostgreSQL in production
DATABASES = {
'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
......@@ -19,6 +23,8 @@ DATABASES = {
}
}
# allowed hosts
ALLOWED_HOSTS = ['.cathdb.info', 'orengoapi01']
# CACHES = {
......@@ -32,9 +38,11 @@ ALLOWED_HOSTS = ['.cathdb.info', 'orengoapi01']
# }
# }
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.mailgun.org'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'mytestuser'
EMAIL_HOST_PASSWORD = 'mytestpassword'
EMAIL_USE_TLS = True
# need to set up mailgun
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# EMAIL_HOST = 'smtp.mailgun.org'
# EMAIL_PORT = 587
# EMAIL_HOST_USER = 'mytestuser'
# EMAIL_HOST_PASSWORD = 'mytestpassword'
# EMAIL_USE_TLS = True
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment