2014-12-04 11:11:46 +00:00
|
|
|
# Production settings
|
|
|
|
from unipath import Path
|
|
|
|
import os
|
|
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).ancestor(2)
|
|
|
|
|
2016-03-07 10:54:51 +00:00
|
|
|
DEBUG = False
|
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
TEMPLATE_DEBUG = DEBUG
|
|
|
|
|
|
|
|
ADMINS = (
|
2015-09-12 22:55:45 +00:00
|
|
|
('Paul Hallett', 'paulandrewhallett@gmail.com'),
|
2014-12-04 11:11:46 +00:00
|
|
|
)
|
|
|
|
|
2015-09-06 01:22:06 +00:00
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
MANAGERS = ADMINS
|
|
|
|
|
2015-09-06 01:22:06 +00:00
|
|
|
BASE_URL = 'http://pokeapi.co'
|
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
|
|
|
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
|
2015-10-06 17:01:32 +00:00
|
|
|
ALLOWED_HOSTS = ['.pokeapi.co', 'localhost']
|
2014-12-04 11:11:46 +00:00
|
|
|
|
|
|
|
TIME_ZONE = 'Europe/London'
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-gb'
|
|
|
|
|
|
|
|
SITE_ID = 1
|
|
|
|
|
|
|
|
# If you set this to False, Django will make some optimizations so as not
|
|
|
|
# to load the internationalization machinery.
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
# If you set this to False, Django will not format dates, numbers and
|
|
|
|
# calendars according to the current locale.
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
|
|
|
USE_TZ = True
|
|
|
|
|
2015-10-18 23:01:33 +00:00
|
|
|
# Explicitly define test runner to avoid warning messages on test execution
|
|
|
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
MEDIA_ROOT = PROJECT_ROOT.child('media')
|
|
|
|
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
2015-10-03 03:40:21 +00:00
|
|
|
STATIC_ROOT = PROJECT_ROOT.child('assets')
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2015-10-03 03:40:21 +00:00
|
|
|
STATIC_URL = '/assets/'
|
2014-12-04 11:11:46 +00:00
|
|
|
|
|
|
|
STATICFILES_DIRS = (
|
2015-12-30 13:22:15 +00:00
|
|
|
# '/pokemon/assets/',
|
2016-01-01 21:48:41 +00:00
|
|
|
# 'pokemon_v2/assets/',
|
2014-12-04 11:11:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
STATICFILES_FINDERS = (
|
|
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
|
|
'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
|
|
|
)
|
|
|
|
|
|
|
|
SECRET_KEY = '4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#'
|
|
|
|
|
|
|
|
TEMPLATE_LOADERS = (
|
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
|
|
|
'django.template.loaders.eggs.Loader',
|
|
|
|
)
|
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES = (
|
2014-12-06 22:57:42 +00:00
|
|
|
'corsheaders.middleware.CorsMiddleware',
|
2014-12-04 11:11:46 +00:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
)
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'config.urls'
|
|
|
|
|
|
|
|
WSGI_APPLICATION = 'config.wsgi.application'
|
|
|
|
|
|
|
|
TEMPLATE_DIRS = (
|
|
|
|
PROJECT_ROOT.child('templates'),
|
|
|
|
)
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
|
|
'NAME': 'pokeapi_co_db',
|
2015-09-19 22:13:41 +00:00
|
|
|
'USER': 'root',
|
2014-12-04 11:11:46 +00:00
|
|
|
'PASSWORD': 'pokeapi',
|
|
|
|
'HOST': 'localhost',
|
|
|
|
'PORT': '',
|
2016-04-30 12:02:27 +00:00
|
|
|
'CONN_MAX_AGE': 30
|
2014-12-04 11:11:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CACHES = {
|
2016-04-30 14:36:56 +00:00
|
|
|
"default": {
|
|
|
|
"BACKEND": "django_redis.cache.RedisCache",
|
|
|
|
"LOCATION": "redis://127.0.0.1:6379/1",
|
|
|
|
"OPTIONS": {
|
|
|
|
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
|
|
|
}
|
|
|
|
}
|
2014-12-04 11:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SECRET_KEY = os.environ.get(
|
|
|
|
'SECRET_KEY',
|
2015-09-12 22:55:45 +00:00
|
|
|
'ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#')
|
2014-12-04 11:11:46 +00:00
|
|
|
|
|
|
|
CUSTOM_APPS = (
|
|
|
|
'tastypie',
|
2014-12-15 10:01:53 +00:00
|
|
|
'pokemon',
|
2015-04-02 12:21:39 +00:00
|
|
|
'pokemon_v2',
|
2014-12-04 11:11:46 +00:00
|
|
|
'hits',
|
2016-08-13 07:24:56 +00:00
|
|
|
'alerts',
|
2014-12-04 11:11:46 +00:00
|
|
|
)
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.humanize',
|
2015-09-06 01:22:06 +00:00
|
|
|
'corsheaders',
|
2016-01-06 22:10:05 +00:00
|
|
|
'rest_framework',
|
2016-04-30 14:36:56 +00:00
|
|
|
'markdown_deux',
|
|
|
|
'cachalot'
|
2014-12-04 11:11:46 +00:00
|
|
|
) + CUSTOM_APPS
|
|
|
|
|
|
|
|
|
|
|
|
API_LIMIT_PER_PAGE = 1
|
|
|
|
|
2014-12-15 10:13:52 +00:00
|
|
|
TASTYPIE_DEFAULT_FORMATS = ['json']
|
2014-12-06 22:57:42 +00:00
|
|
|
|
|
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-06 22:57:42 +00:00
|
|
|
CORS_ALLOW_METHODS = (
|
|
|
|
'GET'
|
|
|
|
)
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2016-04-23 13:37:43 +00:00
|
|
|
CORS_URLS_REGEX = r'^/api/.*$'
|
|
|
|
|
2015-09-06 01:22:06 +00:00
|
|
|
REST_FRAMEWORK = {
|
|
|
|
'DEFAULT_RENDERER_CLASSES': (
|
2016-04-30 12:02:27 +00:00
|
|
|
'drf_ujson.renderers.UJSONRenderer',
|
2015-09-06 01:22:06 +00:00
|
|
|
),
|
2016-03-05 11:40:41 +00:00
|
|
|
'DEFAULT_PARSER_CLASSES': (
|
2016-04-30 12:02:27 +00:00
|
|
|
'drf_ujson.renderers.UJSONRenderer',
|
2015-09-06 01:22:06 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
|
|
|
|
|
|
|
|
'PAGE_SIZE': 20,
|
2016-02-10 13:09:36 +00:00
|
|
|
|
2016-02-10 04:11:37 +00:00
|
|
|
'PAGINATE_BY': 20,
|
2016-07-06 13:04:09 +00:00
|
|
|
'DEFAULT_THROTTLE_CLASSES': (
|
|
|
|
'rest_framework.throttling.AnonRateThrottle',
|
|
|
|
),
|
|
|
|
'DEFAULT_THROTTLE_RATES': {
|
|
|
|
'anon': '1000/hour'
|
|
|
|
}
|
2015-09-06 01:22:06 +00:00
|
|
|
}
|
2016-01-06 22:10:05 +00:00
|
|
|
|
|
|
|
MARKDOWN_DEUX_STYLES = {
|
|
|
|
"default": {
|
|
|
|
"extras": {
|
|
|
|
"code-friendly": None,
|
|
|
|
"tables": None,
|
|
|
|
"fenced-code-blocks": None,
|
|
|
|
"header-ids": None
|
|
|
|
},
|
|
|
|
"safe_mode": False,
|
|
|
|
},
|
|
|
|
}
|
2016-04-22 09:55:42 +00:00
|
|
|
|
|
|
|
# Stripe
|
|
|
|
|
|
|
|
STRIPE_TEST_SECRET_KEY = os.environ.get('STRIPE_TEST_SECRET_KEY', '')
|
|
|
|
STRIPE_SECRET_KEY = os.environ.get('STRIPE_SECRET_KEY', '')
|
|
|
|
STRIPE_PUBLISHABLE_KEY = os.environ.get('STRIPE_PUBLISHABLE_KEY', '')
|
|
|
|
STRIPE_TEST_PUBLISHABLE_KEY = os.environ.get('STRIPE_TEST_PUBLISHABLE_KEY', '')
|
|
|
|
|
|
|
|
if DEBUG:
|
|
|
|
STRIPE_KEYS = {
|
|
|
|
"secret": STRIPE_TEST_SECRET_KEY,
|
|
|
|
"publishable": STRIPE_TEST_PUBLISHABLE_KEY
|
|
|
|
}
|
|
|
|
else:
|
|
|
|
STRIPE_KEYS = {
|
|
|
|
"secret": STRIPE_SECRET_KEY,
|
|
|
|
"publishable": STRIPE_PUBLISHABLE_KEY
|
|
|
|
}
|