2014-12-04 11:11:46 +00:00
|
|
|
# Production settings
|
|
|
|
import os
|
2018-10-20 00:05:10 +00:00
|
|
|
from unipath import Path
|
2014-12-04 11:11:46 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-05-28 07:51:30 +00:00
|
|
|
ADMINS = (
|
|
|
|
os.environ.get("ADMINS", "Paul Hallett,paulandrewhallett@gmail.com").split(","),
|
|
|
|
)
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2020-02-17 20:58:07 +00:00
|
|
|
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
MANAGERS = ADMINS
|
|
|
|
|
2021-05-22 17:20:05 +00:00
|
|
|
BASE_URL = os.environ.get("BASE_URL", "http://pokeapi.co")
|
2015-09-06 01:22:06 +00:00
|
|
|
|
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
|
2021-05-28 07:51:30 +00:00
|
|
|
ALLOWED_HOSTS = [
|
|
|
|
os.environ.get("ALLOWED_HOSTS", ".pokeapi.co"),
|
|
|
|
"localhost",
|
|
|
|
"127.0.0.1",
|
|
|
|
]
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2021-05-22 17:20:05 +00:00
|
|
|
TIME_ZONE = os.environ.get("TIME_ZONE", "Europe/London")
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2021-05-22 17:20:05 +00:00
|
|
|
LANGUAGE_CODE = os.environ.get("LANGUAGE_CODE", "en-gb")
|
2014-12-04 11:11:46 +00:00
|
|
|
|
|
|
|
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
|
2020-02-17 20:58:07 +00:00
|
|
|
TEST_RUNNER = "django.test.runner.DiscoverRunner"
|
2015-10-18 23:01:33 +00:00
|
|
|
|
2018-10-18 20:49:00 +00:00
|
|
|
MIDDLEWARE = [
|
2020-02-17 20:58:07 +00:00
|
|
|
"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",
|
2018-10-18 20:23:48 +00:00
|
|
|
]
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2020-02-17 20:58:07 +00:00
|
|
|
ROOT_URLCONF = "config.urls"
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2020-02-17 20:58:07 +00:00
|
|
|
WSGI_APPLICATION = "config.wsgi.application"
|
2014-12-04 11:11:46 +00:00
|
|
|
|
|
|
|
DATABASES = {
|
2020-02-17 20:58:07 +00:00
|
|
|
"default": {
|
|
|
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
|
|
|
"NAME": "pokeapi_co_db",
|
|
|
|
"USER": "root",
|
|
|
|
"PASSWORD": "pokeapi",
|
|
|
|
"HOST": "localhost",
|
|
|
|
"PORT": "",
|
|
|
|
"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",
|
2020-11-23 21:05:49 +00:00
|
|
|
"OPTIONS": {
|
|
|
|
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
|
|
|
},
|
2016-04-30 14:36:56 +00:00
|
|
|
}
|
2014-12-04 11:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SECRET_KEY = os.environ.get(
|
2020-02-17 20:58:07 +00:00
|
|
|
"SECRET_KEY", "ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#"
|
|
|
|
)
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2023-11-25 12:33:36 +00:00
|
|
|
CUSTOM_APPS = ("pokemon_v2",)
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
INSTALLED_APPS = (
|
2020-02-17 20:58:07 +00:00
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
"django.contrib.sessions",
|
|
|
|
"django.contrib.sites",
|
|
|
|
"django.contrib.admin",
|
2023-11-23 11:05:30 +00:00
|
|
|
"django.contrib.messages",
|
2020-02-17 20:58:07 +00:00
|
|
|
"django.contrib.humanize",
|
|
|
|
"corsheaders",
|
|
|
|
"rest_framework",
|
|
|
|
"cachalot",
|
2024-02-24 07:31:34 +00:00
|
|
|
'drf_spectacular',
|
2014-12-04 11:11:46 +00:00
|
|
|
) + CUSTOM_APPS
|
|
|
|
|
|
|
|
|
|
|
|
API_LIMIT_PER_PAGE = 1
|
|
|
|
|
2014-12-06 22:57:42 +00:00
|
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2020-02-17 20:58:07 +00:00
|
|
|
CORS_ALLOW_METHODS = "GET"
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2020-02-17 20:58:07 +00:00
|
|
|
CORS_URLS_REGEX = r"^/api/.*$"
|
2016-04-23 13:37:43 +00:00
|
|
|
|
2015-09-06 01:22:06 +00:00
|
|
|
REST_FRAMEWORK = {
|
2023-11-22 11:29:16 +00:00
|
|
|
"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
|
|
|
|
"DEFAULT_PARSER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
|
2020-02-17 20:58:07 +00:00
|
|
|
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
|
|
|
|
"PAGE_SIZE": 20,
|
|
|
|
"PAGINATE_BY": 20,
|
2024-02-24 07:31:34 +00:00
|
|
|
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
|
2015-09-06 01:22:06 +00:00
|
|
|
}
|
2023-11-22 11:29:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
2023-11-23 11:05:30 +00:00
|
|
|
"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",
|
2023-11-22 11:29:16 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2023-11-23 11:05:30 +00:00
|
|
|
]
|
2024-01-13 16:57:47 +00:00
|
|
|
|
2024-01-13 17:00:27 +00:00
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
2024-02-24 07:31:34 +00:00
|
|
|
|
|
|
|
SPECTACULAR_SETTINGS = {
|
2024-02-24 07:48:34 +00:00
|
|
|
'TITLE': 'pokeapi',
|
|
|
|
'DESCRIPTION': 'A RESTful API for Pokémon.',
|
2024-02-24 08:05:22 +00:00
|
|
|
'SERVERS': [{'url': 'https://pokeapi.co'}],
|
2024-02-24 07:48:34 +00:00
|
|
|
'EXTERNAL_DOCS': {'url': 'https://pokeapi.co/docs/v2'},
|
|
|
|
'VERSION': '2.7.0',
|
2024-02-24 07:31:34 +00:00
|
|
|
'SERVE_INCLUDE_SCHEMA': False,
|
2024-02-24 07:48:34 +00:00
|
|
|
'OAS_VERSION': '3.1.0',
|
2024-03-04 09:06:12 +00:00
|
|
|
'COMPONENT_SPLIT_REQUEST': True,
|
|
|
|
'TAGS': [
|
|
|
|
'pokemon',
|
|
|
|
'evolution',
|
|
|
|
'berries',
|
|
|
|
'items',
|
|
|
|
'machines',
|
|
|
|
'location',
|
|
|
|
'contest',
|
|
|
|
'moves',
|
|
|
|
'encounters',
|
|
|
|
'games',
|
2024-03-05 06:37:02 +00:00
|
|
|
'utility',
|
|
|
|
],
|
2024-02-24 07:31:34 +00:00
|
|
|
}
|
|
|
|
|