""" Django settings for config project. Generated by 'django-admin startproject' using Django 3.2.9. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path import environ import os import dj_database_url # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent env = environ.Env(DEBUG=(bool, False)) environ.Env.read_env(env_file=".env") # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! #SECRET_KEY = 'django-insecure-@!z!i#bheb)(o1-e2tss(i^dav-ql=cm4*+$unm^3=4)k_ttda' SECRET_KEY = env("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! #DEBUG = True DEBUG = env("DEBUG") #ALLOWED_HOSTS = [] ALLOWED_HOSTS = env("ALLOWED_HOSTS").split(" ") # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.gis', 'rest_framework', 'rest_framework_gis', 'knox', 'leaflet', 'leaflet_admin_list', 'rog.apps.RogConfig', 'django_filters' ] 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', ] ROOT_URLCONF = 'config.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR / 'templates'], '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', ], }, }, ] WSGI_APPLICATION = 'config.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { 'default': dj_database_url.config( default=f'postgis://{env("POSTGRES_USER")}:{env("POSTGRES_PASS")}@{env("PG_HOST")}:{env("PG_PORT")}/{env("POSTGRES_DBNAME")}', conn_max_age=600, conn_health_checks=True, ) } # Password validation # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators 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 # https://docs.djangoproject.com/en/3.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Asia/Tokyo' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = '/static/' #STATIC_URL = '/static2/' STATIC_ROOT = BASE_DIR / "static" MEDIA_URL = '/media/' MEDIA_ROOT = BASE_DIR / "media/" #STATICFILES_DIRS = (os.path.join(BASE_DIR, "static2"),os.path.join(BASE_DIR, "media")) AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend' , 'rog.backend.EmailOrUsernameModelBackend', ) AUTH_USER_MODEL = 'rog.CustomUser' # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' LEAFLET_CONFIG = { 'DEFAULT_CENTER': (35.41864442627996, 138.14094040951784), 'DEFAULT_ZOOM': 6, 'MIN_ZOOM': 3, 'MAX_ZOOM': 19, 'DEFAULT_PRECISION': 6, 'SCALE':"both", 'ATTRIBUTION_PREFIX':"ROGAINING API", 'TILES': [('Satellite', 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {'attribution': '© ESRI', 'maxZoom': 19}), ('Streets', 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {'attribution': '© Contributors'})] } REST_FRAMEWORK = { 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'], 'DEFAULT_AUTHENTICATION_CLASSES': ('knox.auth.TokenAuthentication', ), } #FRONTEND_URL = 'https://rogaining.intranet.sumasen.net' # フロントエンドのURLに適宜変更してください FRONTEND_URL = 'https://rogaining.sumasen.net' # フロントエンドのURLに適宜変更してください # この設定により、メールは実際には送信されず、代わりにコンソールに出力されます。 EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.outlook.com' EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = 'rogaining@gifuai.net' EMAIL_HOST_PASSWORD = 'ctcpy9823"x~' DEFAULT_FROM_EMAIL = 'rogaining@gifuai.net' APP_DOWNLOAD_LINK = 'https://apps.apple.com/jp/app/%E5%B2%90%E9%98%9C%E3%83%8A%E3%83%93/id6444221792' ANDROID_DOWNLOAD_LINK = 'https://play.google.com/store/apps/details?id=com.dvox.gifunavi&hl=ja' SERVICE_NAME = '岐阜ナビ(岐阜ロゲのアプリ)' # settings.py DEFAULT_CHARSET = 'utf-8' #REST_FRAMEWORK = { # 'DEFAULT_RENDERER_CLASSES': [ # 'rest_framework.renderers.JSONRenderer', # ], # 'JSON_UNICODE_ESCAPE': False, #} LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '{levelname} {asctime} {module} {message}', 'style': '{', }, }, 'handlers': { #'file': { # 'level': 'DEBUG', # 'class': 'logging.FileHandler', # 'filename': os.path.join(BASE_DIR, 'logs/debug.log'), # 'formatter': 'verbose', #}, 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'verbose', }, }, 'root': { 'handlers': ['console'], 'level': 'DEBUG', }, 'loggers': { #'django': { # 'handlers': ['console'], # 'level': 'INFO', # 'propagate': False, #}, 'rog': { #'handlers': ['file','console'], 'handlers': ['console'], 'level': 'DEBUG', 'propagate': True, }, }, }