2026-02-19 01:19:22 +03:30
|
|
|
import os
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
|
|
|
|
SECRET_KEY = os.environ.get("SECRET_KEY", "django-insecure-dev-only")
|
|
|
|
|
DEBUG = os.environ.get("DEBUG", "0") == "1"
|
|
|
|
|
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "localhost,127.0.0.1").split(",")
|
|
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
|
"django.contrib.admin",
|
|
|
|
|
"django.contrib.auth",
|
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
|
"django.contrib.sessions",
|
|
|
|
|
"django.contrib.messages",
|
|
|
|
|
"django.contrib.staticfiles",
|
|
|
|
|
"auth.apps.AuthConfig",
|
|
|
|
|
"account",
|
|
|
|
|
"sensor_hub",
|
2026-02-19 16:58:41 +03:30
|
|
|
"dashboard",
|
2026-02-25 12:21:53 +03:30
|
|
|
"crop_zoning",
|
|
|
|
|
"plant_simulator",
|
|
|
|
|
"pest_detection",
|
|
|
|
|
"irrigation_recommendation",
|
|
|
|
|
"fertilization_recommendation",
|
|
|
|
|
"farm_ai_assistant",
|
2026-02-19 01:19:22 +03:30
|
|
|
"rest_framework",
|
|
|
|
|
"corsheaders",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
|
|
"django.middleware.security.SecurityMiddleware",
|
|
|
|
|
"corsheaders.middleware.CorsMiddleware",
|
|
|
|
|
"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"
|
|
|
|
|
WSGI_APPLICATION = "config.wsgi.application"
|
|
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
|
{
|
|
|
|
|
"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",
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
|
"default": {
|
|
|
|
|
"ENGINE": os.environ.get("DB_ENGINE", "django.db.backends.mysql"),
|
|
|
|
|
"NAME": os.environ.get("DB_NAME", "croplogic"),
|
|
|
|
|
"USER": os.environ.get("DB_USER", "croplogic"),
|
|
|
|
|
"PASSWORD": os.environ.get("DB_PASSWORD", ""),
|
|
|
|
|
"HOST": os.environ.get("DB_HOST", "127.0.0.1"),
|
|
|
|
|
"PORT": os.environ.get("DB_PORT", "3306"),
|
|
|
|
|
"OPTIONS": {
|
|
|
|
|
"charset": "utf8mb4",
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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"},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
LANGUAGE_CODE = "en-us"
|
|
|
|
|
TIME_ZONE = "UTC"
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
STATIC_URL = "static/"
|
|
|
|
|
STATIC_ROOT = BASE_DIR / "staticfiles"
|
|
|
|
|
|
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
|
|
|
|
|
|
|
|
CACHES = {
|
|
|
|
|
"default": {
|
|
|
|
|
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
|
|
|
|
|
"LOCATION": "croplogic-auth-otp",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
REST_FRAMEWORK = {
|
|
|
|
|
"DEFAULT_PERMISSION_CLASSES": [
|
|
|
|
|
"rest_framework.permissions.AllowAny",
|
|
|
|
|
],
|
|
|
|
|
"DEFAULT_AUTHENTICATION_CLASSES": [
|
|
|
|
|
"rest_framework_simplejwt.authentication.JWTAuthentication",
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CORS_ALLOW_ALL_ORIGINS = DEBUG
|