UPDATE
This commit is contained in:
+3
-30
@@ -56,8 +56,6 @@ INSTALLED_APPS = [
|
||||
for optional_app in [
|
||||
"rest_framework",
|
||||
"corsheaders",
|
||||
"drf_spectacular",
|
||||
"drf_spectacular_sidecar",
|
||||
]:
|
||||
if importlib.util.find_spec(optional_app):
|
||||
INSTALLED_APPS.insert(6, optional_app)
|
||||
@@ -136,34 +134,6 @@ REST_FRAMEWORK = {
|
||||
"DEFAULT_PERMISSION_CLASSES": [
|
||||
"rest_framework.permissions.AllowAny",
|
||||
],
|
||||
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
||||
}
|
||||
|
||||
SPECTACULAR_SETTINGS = {
|
||||
"TITLE": "CropLogic AI API",
|
||||
"DESCRIPTION": "APIهای هوش مصنوعی CropLogic — داده خاک، سنسور، هواشناسی و چت RAG",
|
||||
"VERSION": "1.0.0",
|
||||
"SERVE_INCLUDE_SCHEMA": False,
|
||||
"SWAGGER_UI_DIST": "SIDECAR",
|
||||
"SWAGGER_UI_FAVICON_HREF": "SIDECAR",
|
||||
"REDOC_DIST": "SIDECAR",
|
||||
"COMPONENT_SPLIT_REQUEST": True,
|
||||
"TAGS": [
|
||||
{"name": "Dashboard Data", "description": "تجمیع دادههای داشبورد مزرعه"},
|
||||
{"name": "Farm Alerts", "description": "tracker و timeline مستقل هشدارهای مزرعه"},
|
||||
{"name": "RAG Chat", "description": "چت هوشمند RAG"},
|
||||
{"name": "Soil Data", "description": "دادههای خاک (SoilGrids)"},
|
||||
{"name": "Soile", "description": "heatmap مستقل رطوبت خاک و داده های مزرعه"},
|
||||
{"name": "Farm Data", "description": "دادههای مزرعه و سنسورها"},
|
||||
{"name": "Economy", "description": "نمای اقتصادی مستقل مزرعه"},
|
||||
{"name": "Farm Parameters", "description": "پارامترهای سنسورهای مزرعه"},
|
||||
{"name": "Plant", "description": "مدیریت گیاهان و دریافت اطلاعات گیاه"},
|
||||
{"name": "Pest & Disease", "description": "تشخیص تصویری و پیش بینی ریسک آفات و بیماری"},
|
||||
{"name": "Crop Simulation", "description": "شبیه سازی رشد و مقایسه سناریوهای گیاه"},
|
||||
{"name": "Irrigation", "description": "مدیریت روشهای آبیاری"},
|
||||
{"name": "Irrigation Recommendation", "description": "درخواست و پیگیری توصیه آبیاری"},
|
||||
{"name": "Fertilization Recommendation", "description": "درخواست و پیگیری توصیه کودهی"},
|
||||
],
|
||||
}
|
||||
|
||||
CORS_ALLOW_ALL_ORIGINS = DEBUG
|
||||
@@ -197,6 +167,9 @@ WEATHER_TIMEOUT_SECONDS = float(os.environ.get("WEATHER_TIMEOUT_SECONDS", "60"))
|
||||
SOIL_DATA_PROVIDER = os.environ.get("SOIL_DATA_PROVIDER", "mock").strip().lower()
|
||||
SOIL_MOCK_DELAY_SECONDS = float(os.environ.get("SOIL_MOCK_DELAY_SECONDS", "0.8"))
|
||||
SOILGRIDS_TIMEOUT_SECONDS = float(os.environ.get("SOILGRIDS_TIMEOUT_SECONDS", "60"))
|
||||
BACKEND_PLANT_SYNC_BASE_URL = os.environ.get("BACKEND_PLANT_SYNC_BASE_URL", "")
|
||||
BACKEND_PLANT_SYNC_API_KEY = os.environ.get("BACKEND_PLANT_SYNC_API_KEY", "")
|
||||
BACKEND_PLANT_SYNC_TIMEOUT = int(os.environ.get("BACKEND_PLANT_SYNC_TIMEOUT", "20"))
|
||||
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from drf_spectacular.views import (
|
||||
SpectacularAPIView,
|
||||
SpectacularRedocView,
|
||||
SpectacularSwaggerView,
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
# --- OpenAPI / Swagger ---
|
||||
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
|
||||
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
|
||||
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
|
||||
# --- App APIs ---
|
||||
path("api/rag/", include("rag.urls")),
|
||||
path("api/farm-alerts/", include("farm_alerts.urls")),
|
||||
|
||||
Reference in New Issue
Block a user