first base of project-changed apps: Herd-livestock-tag-log-elasticsearch-
This commit is contained in:
@@ -10,8 +10,9 @@ For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||
"""
|
||||
import os.path
|
||||
from pathlib import Path
|
||||
from datetime import timedelta
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
@@ -42,6 +43,7 @@ INSTALLED_APPS = [
|
||||
'rest_framework',
|
||||
"corsheaders",
|
||||
'rest_framework_simplejwt',
|
||||
'rest_framework_simplejwt.token_blacklist',
|
||||
'apps.authentication.apps.AuthenticationConfig',
|
||||
'apps.authorization.apps.AuthorizationConfig',
|
||||
'apps.captcha_app.apps.CaptchaAppConfig',
|
||||
@@ -52,8 +54,10 @@ INSTALLED_APPS = [
|
||||
'apps.tag.apps.TagConfig',
|
||||
'apps.warehouse.apps.WarehouseConfig',
|
||||
'apps.search.apps.SearchConfig',
|
||||
'apps.log.apps.LogConfig',
|
||||
'rest_captcha',
|
||||
'captcha',
|
||||
'drf_yasg'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
@@ -64,6 +68,8 @@ MIDDLEWARE = [
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'crum.CurrentRequestUserMiddleware',
|
||||
'apps.log.middlewares.SaveLog'
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'Rasaddam_Backend.urls'
|
||||
@@ -88,6 +94,14 @@ WSGI_APPLICATION = 'Rasaddam_Backend.wsgi.application'
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||
|
||||
MONGODB_DATABASES = {
|
||||
"default": {
|
||||
"name": 'mongodb',
|
||||
"host": "",
|
||||
"tz_aware": True, # if you using timezones in django (USE_TZ = True) # noqa
|
||||
},
|
||||
}
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
@@ -96,11 +110,28 @@ DATABASES = {
|
||||
'USER': "root",
|
||||
'PASSWORD': "aFC3hqbxxR0SeBPZ6TCZ37my",
|
||||
'PORT': '32718'
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
AUTH_USER_MODEL = 'authentication.User'
|
||||
|
||||
SWAGGER_SETTINGS = {
|
||||
'SECURITY_DEFINITIONS': {
|
||||
'Bearer': {
|
||||
'type': 'apiKey',
|
||||
'name': 'Authorization',
|
||||
'in': 'header'
|
||||
},
|
||||
'basic': { # <<-- is for djagno authentication
|
||||
'type': 'basic'
|
||||
},
|
||||
},
|
||||
'USE_SESSION_AUTH': True,
|
||||
}
|
||||
|
||||
LOGIN_URL = 'rest_framework:login'
|
||||
LOGOUT_URL = 'rest_framework:logout'
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_PERMISSION_CLASSES': (
|
||||
'rest_framework.permissions.IsAuthenticated',
|
||||
@@ -111,7 +142,8 @@ REST_FRAMEWORK = {
|
||||
'rest_framework.authentication.BasicAuthentication',
|
||||
),
|
||||
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
|
||||
"PAGE_SIZE": 25
|
||||
"PAGE_SIZE": 25,
|
||||
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema'
|
||||
}
|
||||
|
||||
SIMPLE_JWT = {
|
||||
@@ -189,12 +221,11 @@ ELASTICSEARCH_DSL = {
|
||||
# liara elastic password uYkiQ860vLW8DIbWpNjqtz2B # noqa
|
||||
# local system password =z66+LCIebq4NQRR_+=R # noqa
|
||||
"default": {
|
||||
"hosts": "http://damelasticsearch:9200",
|
||||
"hosts": "http://monte-rosa.liara.cloud:31157",
|
||||
"http_auth": ("elastic", "uYkiQ860vLW8DIbWpNjqtz2B"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||
|
||||
@@ -245,6 +276,7 @@ CORS_ORIGIN_WHITELIST = (
|
||||
'http://127.0.0.1:8080',
|
||||
'http://127.0.0.1:3000',
|
||||
'http://localhost:3000',
|
||||
'http://192.168.88.130:3000',
|
||||
'https://rasadyar.net'
|
||||
)
|
||||
|
||||
@@ -253,6 +285,7 @@ CORS_ALLOWED_ORIGINS = (
|
||||
'http://127.0.0.1:8080',
|
||||
'http://127.0.0.1:3000',
|
||||
'http://localhost:3000',
|
||||
'http://192.168.88.130:3000',
|
||||
'https://rasadyar.net'
|
||||
)
|
||||
|
||||
|
||||
@@ -16,10 +16,18 @@ Including another URLconf
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from apps.core.swagger import schema_view
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||
path('auth/', include('apps.authentication.urls')),
|
||||
path('auth/', include('apps.authorization.urls')),
|
||||
path('', include('apps.captcha_app.api.v1.urls')),
|
||||
path('', include('apps.core.urls')),
|
||||
path('herd/', include('apps.herd.urls')),
|
||||
path('livestock/', include('apps.livestock.urls')),
|
||||
path('tag/', include('apps.tag.urls')),
|
||||
path('search/', include('apps.search.urls')),
|
||||
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user