initail elasticsearch

This commit is contained in:
2025-05-06 16:22:35 +03:30
parent ec58d9ef5e
commit 3dce7fc344
18 changed files with 176 additions and 11 deletions

View File

@@ -14,11 +14,9 @@ from pathlib import Path
from datetime import timedelta
from django.conf import settings
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
@@ -28,8 +26,7 @@ SECRET_KEY = 'django-insecure-@0apn-lk85pfw=z00x2ib$w9#rwz8%2v4i_n^^9jz-m9b+y55*
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'https://rasadyar.net/']
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'https://rasadyar.net/', 'https://localhost:9200']
# Application definition
@@ -40,6 +37,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_elasticsearch_dsl',
'django_elasticsearch_dsl_drf',
'rest_framework',
"corsheaders",
'rest_framework_simplejwt',
@@ -52,6 +51,7 @@ INSTALLED_APPS = [
'apps.pos_machine.apps.PosMachineConfig',
'apps.tag.apps.TagConfig',
'apps.warehouse.apps.WarehouseConfig',
'apps.search.apps.SearchConfig',
'rest_captcha',
'captcha',
]
@@ -85,7 +85,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'Rasaddam_Backend.wsgi.application'
# Database
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
@@ -111,6 +110,8 @@ REST_FRAMEWORK = {
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
),
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"PAGE_SIZE": 25
}
SIMPLE_JWT = {
@@ -183,6 +184,17 @@ REST_CAPTCHA = {
'NOISE_FUNCTION': 'apps.captcha_app.api.v1.serializers.noise_default'
}
ELASTICSEARCH_DSL = {
# elastic HSA256 finger print f7d94c1da0668ba7874e5e09c3b1b91284fcdda97c361e0165401dc9375531b0 # noqa
# liara elastic password uYkiQ860vLW8DIbWpNjqtz2B # noqa
# local system password =z66+LCIebq4NQRR_+=R # noqa
"default": {
"hosts": "https://127.0.0.1:9200",
"http_auth": ("elastic", "uYkiQ860vLW8DIbWpNjqtz2B"),
}
}
# Password validation
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
@@ -201,7 +213,6 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Internationalization
# https://docs.djangoproject.com/en/5.2/topics/i18n/
@@ -245,7 +256,6 @@ CORS_ALLOWED_ORIGINS = (
'https://rasadyar.net'
)
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False