mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-22 11:23:13 +00:00
192 lines
4.4 KiB
Python
Executable file
192 lines
4.4 KiB
Python
Executable file
# Production settings
|
|
from unipath import Path
|
|
import os
|
|
|
|
PROJECT_ROOT = Path(__file__).ancestor(2)
|
|
|
|
DEBUG = False
|
|
|
|
TEMPLATE_DEBUG = DEBUG
|
|
|
|
ADMINS = (
|
|
('Paul Hallett', 'paulandrewhallett@gmail.com'),
|
|
)
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
MANAGERS = ADMINS
|
|
|
|
BASE_URL = 'http://pokeapi.co'
|
|
|
|
# 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
|
|
ALLOWED_HOSTS = ['.pokeapi.co', 'localhost']
|
|
|
|
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
|
|
|
|
# Explicitly define test runner to avoid warning messages on test execution
|
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
|
|
|
MEDIA_ROOT = PROJECT_ROOT.child('media')
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
STATIC_ROOT = PROJECT_ROOT.child('assets')
|
|
|
|
STATIC_URL = '/assets/'
|
|
|
|
STATICFILES_DIRS = (
|
|
# '/pokemon/assets/',
|
|
# 'pokemon_v2/assets/',
|
|
)
|
|
|
|
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 = (
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
'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',
|
|
'USER': 'root',
|
|
'PASSWORD': 'pokeapi',
|
|
'HOST': 'localhost',
|
|
'PORT': '',
|
|
}
|
|
}
|
|
|
|
CACHES = {
|
|
'default': {
|
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
|
'TIMEOUT': 30
|
|
},
|
|
'resources': {
|
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
|
'TIMEOUT': 360
|
|
}
|
|
}
|
|
|
|
SECRET_KEY = os.environ.get(
|
|
'SECRET_KEY',
|
|
'ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#')
|
|
|
|
CUSTOM_APPS = (
|
|
'tastypie',
|
|
'pokemon',
|
|
'pokemon_v2',
|
|
'hits',
|
|
)
|
|
|
|
INSTALLED_APPS = (
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.sites',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.admin',
|
|
'django.contrib.humanize',
|
|
'corsheaders',
|
|
'rest_framework',
|
|
'markdown_deux'
|
|
) + CUSTOM_APPS
|
|
|
|
|
|
API_LIMIT_PER_PAGE = 1
|
|
|
|
TASTYPIE_DEFAULT_FORMATS = ['json']
|
|
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
|
|
|
CORS_ALLOW_METHODS = (
|
|
'GET'
|
|
)
|
|
|
|
CORS_URLS_REGEX = r'^/api/.*$'
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_RENDERER_CLASSES': (
|
|
'rest_framework.renderers.JSONRenderer',
|
|
),
|
|
'DEFAULT_PARSER_CLASSES': (
|
|
'rest_framework.parsers.JSONParser',
|
|
),
|
|
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
|
|
|
|
'PAGE_SIZE': 20,
|
|
|
|
'PAGINATE_BY': 20,
|
|
}
|
|
|
|
MARKDOWN_DEUX_STYLES = {
|
|
"default": {
|
|
"extras": {
|
|
"code-friendly": None,
|
|
"tables": None,
|
|
"fenced-code-blocks": None,
|
|
"header-ids": None
|
|
},
|
|
"safe_mode": False,
|
|
},
|
|
}
|
|
|
|
# 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
|
|
}
|