UPDATE
This commit is contained in:
@@ -7,6 +7,8 @@ from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
LOG_DIR = BASE_DIR / "logs"
|
||||
LOG_DIR.mkdir(exist_ok=True)
|
||||
|
||||
|
||||
def _get_csv_env(name, default=""):
|
||||
@@ -224,3 +226,39 @@ CELERY_WORKER_PREFETCH_MULTIPLIER = int(os.getenv("CELERY_WORKER_PREFETCH_MULTIP
|
||||
CELERY_TASK_TIME_LIMIT = int(os.getenv("CELERY_TASK_TIME_LIMIT", "120"))
|
||||
CELERY_TASK_SOFT_TIME_LIMIT = int(os.getenv("CELERY_TASK_SOFT_TIME_LIMIT", "90"))
|
||||
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = os.getenv("CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP", "true").lower() == "true"
|
||||
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"formatters": {
|
||||
"standard": {
|
||||
"format": "%(asctime)s %(levelname)s %(name)s %(message)s",
|
||||
},
|
||||
},
|
||||
"handlers": {
|
||||
"farm_ai_assistant_file": {
|
||||
"level": "WARNING",
|
||||
"class": "logging.FileHandler",
|
||||
"filename": LOG_DIR / "farm_ai_assistant.log",
|
||||
"formatter": "standard",
|
||||
},
|
||||
"external_api_adapter_file": {
|
||||
"level": "WARNING",
|
||||
"class": "logging.FileHandler",
|
||||
"filename": LOG_DIR / "external_api_adapter.log",
|
||||
"formatter": "standard",
|
||||
},
|
||||
},
|
||||
"loggers": {
|
||||
"farm_ai_assistant": {
|
||||
"handlers": ["farm_ai_assistant_file"],
|
||||
"level": "WARNING",
|
||||
"propagate": False,
|
||||
},
|
||||
"external_api_adapter": {
|
||||
"handlers": ["external_api_adapter_file"],
|
||||
"level": "WARNING",
|
||||
"propagate": False,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
+26
-1
@@ -1,6 +1,10 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
from drf_spectacular.utils import inline_serializer
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import OpenApiParameter, inline_serializer
|
||||
|
||||
|
||||
FARM_UUID_DEFAULT = "11111111-1111-1111-1111-111111111111"
|
||||
|
||||
|
||||
class AuthTokenSerializer(serializers.Serializer):
|
||||
@@ -28,3 +32,24 @@ def status_response(name, data=None):
|
||||
if data is not None:
|
||||
fields["data"] = data
|
||||
return inline_serializer(name=name, fields=fields)
|
||||
|
||||
|
||||
def farm_uuid_query_param(required=False, description="UUID of the farm."):
|
||||
return OpenApiParameter(
|
||||
name="farm_uuid",
|
||||
type=OpenApiTypes.UUID,
|
||||
location=OpenApiParameter.QUERY,
|
||||
required=required,
|
||||
description=description,
|
||||
default=FARM_UUID_DEFAULT,
|
||||
)
|
||||
|
||||
|
||||
def sensor_uuid_query_param(required=False, description="Optional sensor UUID."):
|
||||
return OpenApiParameter(
|
||||
name="sensor_uuid",
|
||||
type=OpenApiTypes.UUID,
|
||||
location=OpenApiParameter.QUERY,
|
||||
required=required,
|
||||
description=description,
|
||||
)
|
||||
|
||||
+13
-8
@@ -1,7 +1,6 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
|
||||
from yield_harvest.urls import plant_simulator_urlpatterns
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
@@ -17,17 +16,23 @@ urlpatterns = [
|
||||
path("api/farm-dashboard/", include("dashboard.urls")),
|
||||
path("api/crop-health/", include("crop_health.urls")),
|
||||
path("api/soil/", include("soil.urls")),
|
||||
|
||||
path("api/crop-zoning/", include("crop_zoning.urls")),
|
||||
path("api/plant-simulator/", include(plant_simulator_urlpatterns)),
|
||||
path("api/pest-detection/", include("pest_detection.urls")),
|
||||
path("api/sensor-7-in-1/", include("sensor_7_in_1.urls")),
|
||||
path("api/irrigation-recommendation/", include("irrigation_recommendation.urls")),
|
||||
path("api/water/", include("water.urls")),
|
||||
path("api/yield-harvest/", include("yield_harvest.urls")),
|
||||
path("api/economic-overview/", include("economic_overview.urls")),
|
||||
path("api/fertilization-recommendation/", include("fertilization_recommendation.urls")),
|
||||
|
||||
path("api/pest-detection/", include("pest_detection.urls")),
|
||||
path("api/pest-disease/", include("pest_detection.pest_disease_urls")),
|
||||
path("api/sensor-7-in-1/", include("sensor_7_in_1.urls")),
|
||||
path("api/irrigation/", include("irrigation_recommendation.urls")),
|
||||
|
||||
path("api/weather/", include("water.weather_urls")),
|
||||
path("api/water/", include("water.urls")),
|
||||
path("api/economy/", include("economic_overview.urls")),
|
||||
|
||||
path("api/fertilization/", include("fertilization_recommendation.urls")),
|
||||
path("api/farm-ai-assistant/", include("farm_ai_assistant.urls")),
|
||||
path("api/notifications/", include("notifications.urls")),
|
||||
path("api/farm-alerts/", include("farm_alerts.urls")),
|
||||
|
||||
path("api/sensor-external-api/", include("sensor_external_api.urls")),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user