github.com/ismailbayram/bigpicture@v0.0.0-20231225173155-e4b21f5efcff/internal/browser/pyproject/washer_project/settings.py (about) 1 """ 2 Django settings for washer_project project. 3 4 Generated by 'django-admin startproject' using Django 2.2.2. 5 6 For more information on this file, see 7 https://docs.djangoproject.com/en/2.2/topics/settings/ 8 9 For the full list of settings and their values, see 10 https://docs.djangoproject.com/en/2.2/ref/settings/ 11 """ 12 13 import datetime 14 import os 15 from decimal import Decimal 16 17 # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 18 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 19 20 21 # Quick-start development settings - unsuitable for production 22 # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ 23 24 # SECURITY WARNING: keep the secret key used in production secret! 25 SECRET_KEY = '5oye%kl&wmh81y$p#4_rc!yb=0m&y76unw=fq(vufvdow&3dl3' 26 27 # SECURITY WARNING: don't run with debug turned on in production! 28 DEBUG = False 29 30 ALLOWED_HOSTS = ['*'] 31 32 33 # Application definition 34 35 INSTALLED_APPS = [ 36 'django.contrib.auth', 37 'django.contrib.contenttypes', 38 'django.contrib.staticfiles', 39 'django_extensions', 40 'django_filters', 41 'rest_framework', 42 'base', 43 'users', 44 'address', 45 'stores', 46 'cars', 47 'products', 48 'baskets', 49 'reservations', 50 'notifications', 51 'search', 52 ] 53 54 MIDDLEWARE = [ 55 'django.middleware.security.SecurityMiddleware', 56 'django.middleware.common.CommonMiddleware', 57 'django.middleware.csrf.CsrfViewMiddleware', 58 'django.middleware.clickjacking.XFrameOptionsMiddleware', 59 ] 60 61 ROOT_URLCONF = 'washer_project.urls' 62 63 WSGI_APPLICATION = 'washer_project.wsgi.application' 64 65 66 # Database 67 # https://docs.djangoproject.com/en/2.2/ref/settings/#databases 68 69 DATABASES = { 70 'default': { 71 'ENGINE': 'django.db.backends.postgresql', 72 'NAME': 'washer', 73 'USER': 'postgres', 74 'PORT': 5432, 75 } 76 } 77 78 REST_FRAMEWORK = { 79 'DEFAULT_FILTER_BACKENDS': ( 80 'django_filters.rest_framework.DjangoFilterBackend', 81 'rest_framework.filters.OrderingFilter', 82 ), 83 'DEFAULT_RENDERER_CLASSES': ( 84 'rest_framework.renderers.JSONRenderer', 85 ), 86 'DEFAULT_PARSER_CLASSES': ( 87 'rest_framework.parsers.JSONParser', 88 ), 89 'DEFAULT_PAGINATION_CLASS': 'api.pagination.WasherPageNumberPagination', 90 'ORDERING_PARAM': 'sort', 91 'PAGINATE_BY': 20, 92 'PAGE_SIZE': 20, 93 'DEFAULT_AUTHENTICATION_CLASSES': ( 94 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 95 ), 96 'DEFAULT_PERMISSION_CLASSES': ( 97 'rest_framework.permissions.AllowAny', 98 ), 99 'EXCEPTION_HANDLER': 'api.exceptions.exception_handler', 100 } 101 102 JWT_AUTH = { 103 'JWT_VERIFY': True, 104 'JWT_VERIFY_EXPIRATION': True, 105 'JWT_ALLOW_REFRESH': True, 106 'JWT_EXPIRATION_DELTA': datetime.timedelta(days=365), 107 'JWT_AUTH_HEADER_PREFIX': 'Token', 108 'JWT_PAYLOAD_HANDLER': 'users.utils.jwt_payload_handler', 109 } 110 111 112 TEMPLATES = [ 113 { 114 'BACKEND': 'django.template.backends.django.DjangoTemplates', 115 'DIRS': [os.path.join(BASE_DIR, 'templates')], 116 'APP_DIRS': True, 117 'OPTIONS': { 118 'context_processors': [ 119 'django.template.context_processors.debug', 120 'django.template.context_processors.request', 121 'django.contrib.auth.context_processors.auth', 122 'django.contrib.messages.context_processors.messages', 123 ], 124 }, 125 }, 126 ] 127 128 # Internationalization 129 # https://docs.djangoproject.com/en/2.2/topics/i18n/ 130 131 LANGUAGE_CODE = 'tr-tr' 132 133 LANGUAGES = [ 134 ('tr-tr', 'Turkish'), 135 ] 136 137 TIME_ZONE = 'Europe/Istanbul' 138 USE_I18N = True 139 USE_L10N = True 140 USE_TZ = True 141 142 BROKER_URL = 'redis://localhost:6379' 143 CELERY_RESULT_BACKEND = 'redis://localhost:6379' 144 CELERY_ACCEPT_CONTENT = ['application/json'] 145 CELERY_TASK_SERIALIZER = 'json' 146 CELERY_RESULT_SERIALIZER = 'json' 147 CELERY_TIMEZONE = TIME_ZONE 148 149 ES_HOST = {"host": "127.0.0.1", "port": 9200} 150 ES_STORE_INDEX = 'stores' 151 ES_RESERVATION_INDEX = 'reservations' 152 153 AUTH_USER_MODEL = 'users.User' 154 155 STATIC_URL = '/static/' 156 MEDIA_URL = '/media/' 157 MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 158 159 IMAGE_SIZES = { 160 # To get the full size "full" 161 "100x100": { 162 "height": 100, 163 "width": 100, 164 }, 165 "250x250": { 166 "height": 250, 167 "width": 250, 168 }, 169 } 170 171 DEFAULT_PRODUCT_PRICE = Decimal('30.00') 172 MINIMUM_PRODUCT_PRICE = Decimal('0.99') 173 174 LOGGING = { 175 'version': 1, 176 'disable_existing_loggers': False, 177 'formatters': { 178 'app_log_formatter': { 179 'format': '{levelname} {asctime} :: {message}\n', 180 'style': '{', 181 }, 182 }, 183 'handlers': { 184 'log_file': { 185 'level': 'WARNING', 186 'class': 'logging.FileHandler', 187 'filename': 'logs/app.log', 188 'formatter': 'app_log_formatter', 189 }, 190 }, 191 'loggers': {}, 192 'root': { 193 'handlers': ['log_file'], 194 'level': 'DEBUG', 195 'propagate': False, 196 } 197 } 198 199 CACHE_TTL = 60 * 5 # 5 minutes 200 CACHES = { 201 "default": { 202 "BACKEND": "django_redis.cache.RedisCache", 203 "LOCATION": "redis://127.0.0.1:6379/1", 204 "TIMEOUT": CACHE_TTL, # 5 minutes 205 "OPTIONS": { 206 "CLIENT_CLASS": "django_redis.client.DefaultClient" 207 }, 208 "KEY_PREFIX": "_aracyika_" 209 } 210 } 211 212 213 SMS_CODE_CACHE_KEY_FORMAT = 'SMS_CODE:{}' 214 215 try: 216 from washer_project.settings_local import * 217 except ImportError: 218 pass