Created
June 13, 2017 16:26
-
-
Save listenrightmeow/85ab305a69a267000cd9e2514d02653e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'standard': { | |
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s' | |
} | |
}, | |
'handlers': { | |
'console': { | |
'level': 'DEBUG', | |
'class': 'logging.StreamHandler', | |
'stream': sys.stdout, | |
'formatter': 'standard' | |
}, | |
}, | |
'loggers': { | |
'stdout': { | |
'handlers': ['console'] | |
}, | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'verbose': { | |
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' | |
}, | |
'simple': { | |
'format': '%(levelname)s %(message)s' | |
}, | |
'json': { | |
'format': '{ "loggerName":"%(name)s", "asciTime":"%(asctime)s", "fileName":"%(filename)s", "logRecordCreationTime":"%(created)f", "functionName":"%(funcName)s", "levelNo":"%(levelno)s", "lineNo":"%(lineno)d", "time":"%(msecs)d", "levelName":"%(levelname)s", "message":"%(message)s"}', | |
}, | |
}, | |
'handlers': { | |
'loggly': { | |
'class': 'loggly.handlers.HTTPSHandler', | |
'level': 'INFO', | |
'formatter': 'json', | |
'url': 'https://logs-01.loggly.com/inputs/{0}/tag/menu'.format(os.getenv('LOGGLY_TOKEN')), | |
}, | |
}, | |
'loggers': { | |
'menu': { | |
'handlers': ['loggly'], | |
'level': 'INFO', | |
}, | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from .base import * | |
import importlib | |
globals().update(importlib.import_module('cannabis_menu.menu.settings.logging.{0}'.format(os.environ.get('BUILD_ENVIRONMENT'))).__dict__) | |
globals().update(importlib.import_module('cannabis_menu.menu.settings.template.{0}'.format(os.environ.get('BUILD_ENVIRONMENT'))).__dict__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Django settings for cannabis_menu project. | |
Generated by 'django-admin startproject' using Django 1.10.5. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/1.10/topics/settings/ | |
For the full list of settings and their values, see | |
https://docs.djangoproject.com/en/1.10/ref/settings/ | |
""" | |
import os | |
import sys | |
def __init__(self): | |
pass | |
CACHES = { | |
"default": { | |
"BACKEND": "django_redis.cache.RedisCache", | |
"LOCATION": "redis://redis.tryfynd.com:6379/0", | |
"TIMEOUT": 900, | |
"OPTIONS": { | |
"CLIENT_CLASS": "django_redis.client.DefaultClient", | |
"IGNORE_EXCEPTIONS": True | |
} | |
} | |
} | |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
SECRET_KEY = os.environ.get('SECRET_KEY', 'development') | |
DEBUG = os.environ.get('DEBUG', 'False') | |
ADMINS = ((os.environ.get('ADMIN_USER'), os.environ.get('ADMIN_EMAIL'))) | |
ALLOWED_HOSTS = [ | |
'*', | |
'127.0.0.1', | |
'.fynd.team', | |
'.tryfynd.dev', | |
'.tryfynd.com', | |
'.luxpotshop.com' | |
'.thegrassisalways.com' | |
] | |
# Application definition | |
INSTALLED_APPS = [ | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
'cannabis_menu.menu' | |
] | |
MIDDLEWARE = [ | |
'django.middleware.security.SecurityMiddleware', | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.middleware.common.CommonMiddleware', | |
# 'django.middleware.csrf.CsrfViewMiddleware', | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django.contrib.messages.middleware.MessageMiddleware', | |
'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
'whitenoise.middleware.WhiteNoiseMiddleware' | |
] | |
TEMPLATES = [ | |
{ | |
'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
'DIRS': [], | |
'APP_DIRS': True, | |
'OPTIONS': { | |
'context_processors': [ | |
'django.template.context_processors.debug', | |
'django.template.context_processors.request', | |
'django.contrib.auth.context_processors.auth', | |
'django.contrib.messages.context_processors.messages' | |
] | |
} | |
} | |
] | |
ROOT_URLCONF = 'cannabis_menu.urls' | |
WSGI_APPLICATION = 'cannabis_menu.wsgi.application' | |
# Database | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
'CONN_MAX_AGE': 900, | |
'NAME': os.environ.get('POSTGRES_DB'), | |
'USER': os.environ.get('POSTGRES_USER'), | |
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'), | |
'HOST': os.environ.get('POSTGRES_HOST'), | |
'PORT': os.environ.get('POSTGRES_PORT', '5432') | |
} | |
} | |
DATABASE_URL = '{0}:{1}'.format(os.environ.get('POSTGRES_HOST'), os.environ.get('POSTGRES_PORT', '5432')) | |
# Password validation | |
LOGIN_URL = '/login/' | |
AUTH_PASSWORD_VALIDATORS = [ | |
{ | |
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator' | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator' | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator' | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator' | |
}, | |
] | |
# Internationalization | |
LANGUAGE_CODE = 'en-us' | |
TIME_ZONE = 'UTC' | |
USE_I18N = True | |
USE_L10N = True | |
USE_TZ = True | |
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') | |
MEDIA_URL = '/media/' | |
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) | |
PROJECT_DIR = os.path.dirname(os.path.dirname(__file__)) | |
STATIC_URL = '/static/' | |
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' | |
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') | |
SERVER_EMAIL = os.environ.get('EMAIL_ADDRESS') | |
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |
EMAIL_HOST = os.environ.get('EMAIL_HOST') | |
EMAIL_PORT = os.environ.get('EMAIL_PORT') | |
EMAIL_HOST_USER = os.environ.get('EMAIL_USER') | |
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASSWORD') | |
EMAIL_USE_SSL = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment