django-cfg 1.4.116__py3-none-any.whl → 1.5.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of django-cfg might be problematic. Click here for more details.
- django_cfg/__init__.py +6 -1
- django_cfg/apps/api/commands/serializers.py +152 -0
- django_cfg/apps/api/commands/views.py +32 -0
- django_cfg/apps/{accounts → business/accounts}/admin/inlines.py +2 -2
- django_cfg/apps/{accounts → business/accounts}/admin/user_admin.py +2 -2
- django_cfg/apps/{accounts → business/accounts}/apps.py +2 -2
- django_cfg/apps/{accounts → business/accounts}/management/commands/otp_test.py +5 -2
- django_cfg/apps/{accounts → business/accounts}/managers/user_manager.py +2 -2
- django_cfg/apps/{accounts → business/accounts}/migrations/0001_initial.py +4 -4
- django_cfg/apps/{agents → business/agents}/__init__.py +1 -1
- django_cfg/apps/{agents → business/agents}/apps.py +1 -1
- django_cfg/apps/business/agents/management/commands/create_agent.py +177 -0
- django_cfg/apps/{agents/management/commands/create_agent.py → business/agents/management/commands/load_agent_templates.py} +6 -167
- django_cfg/apps/{agents → business/agents}/management/commands/orchestrator_status.py +7 -5
- django_cfg/apps/{knowbase → business/knowbase}/__init__.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/apps.py +3 -3
- django_cfg/apps/business/knowbase/examples/__init__.py +3 -0
- django_cfg/apps/{knowbase → business/knowbase}/examples/external_data_usage.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/management/commands/knowbase_stats.py +4 -2
- django_cfg/apps/{knowbase → business/knowbase}/management/commands/setup_knowbase.py +4 -2
- django_cfg/apps/{knowbase → business/knowbase}/mixins/examples/vehicle_model_example.py +2 -2
- django_cfg/apps/{knowbase → business/knowbase}/mixins/service.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/models/external_data.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/services/archive/vectorization_service.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/services/embedding/async_processor.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/services/embedding/batch_processor.py +2 -2
- django_cfg/apps/{knowbase → business/knowbase}/services/embedding/processors.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/services/embedding/utils.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/tasks/document_processing.py +1 -1
- django_cfg/apps/{knowbase → business/knowbase}/utils/chunk_settings.py +6 -5
- django_cfg/apps/{knowbase → business/knowbase}/views/archive_views.py +2 -2
- django_cfg/apps/{leads → business/leads}/apps.py +2 -2
- django_cfg/apps/{newsletter → business/newsletter}/admin/newsletter_admin.py +12 -11
- django_cfg/apps/{newsletter → business/newsletter}/apps.py +2 -2
- django_cfg/apps/{newsletter → business/newsletter}/management/commands/test_newsletter.py +7 -4
- django_cfg/apps/{payments → business/payments}/__init__.py +2 -2
- django_cfg/apps/{payments → business/payments}/admin/balance_admin.py +26 -36
- django_cfg/apps/{payments → business/payments}/admin/payment_admin.py +65 -85
- django_cfg/apps/{payments → business/payments}/admin/withdrawal_admin.py +65 -100
- django_cfg/apps/{payments → business/payments}/apps.py +1 -1
- django_cfg/apps/{payments → business/payments}/management/commands/check_payment_status.py +8 -6
- django_cfg/apps/{payments → business/payments}/management/commands/create_payment.py +7 -5
- django_cfg/apps/{payments → business/payments}/management/commands/sync_currencies.py +6 -4
- django_cfg/apps/{payments → business/payments}/urls.py +1 -1
- django_cfg/apps/{support → business/support}/apps.py +1 -1
- django_cfg/apps/{support → business/support}/managers/message_manager.py +1 -1
- django_cfg/apps/{support → business/support}/managers/ticket_manager.py +1 -1
- django_cfg/apps/{centrifugo → integrations/centrifugo}/__init__.py +2 -2
- django_cfg/apps/integrations/centrifugo/_cfg/README_DEPENDENCIES.md +260 -0
- django_cfg/apps/integrations/centrifugo/_cfg/__init__.py +25 -0
- django_cfg/apps/integrations/centrifugo/_cfg/check_deps.py +34 -0
- django_cfg/apps/integrations/centrifugo/_cfg/dependencies.py +309 -0
- django_cfg/apps/{centrifugo → integrations/centrifugo}/admin/centrifugo_log.py +33 -71
- django_cfg/apps/integrations/centrifugo/apps.py +100 -0
- django_cfg/apps/{centrifugo → integrations/centrifugo}/management/commands/generate_centrifugo_clients.py +9 -9
- django_cfg/apps/{centrifugo → integrations/centrifugo}/serializers/__init__.py +4 -3
- django_cfg/apps/integrations/centrifugo/serializers/publishes.py +38 -0
- django_cfg/apps/{centrifugo → integrations/centrifugo}/serializers/stats.py +2 -2
- django_cfg/apps/{centrifugo → integrations/centrifugo}/services/client/client.py +2 -2
- django_cfg/apps/{centrifugo → integrations/centrifugo}/services/client/config.py +1 -1
- django_cfg/apps/{centrifugo → integrations/centrifugo}/views/monitoring.py +28 -43
- django_cfg/apps/integrations/grpc/__init__.py +9 -0
- django_cfg/apps/integrations/grpc/_cfg/README_DEPENDENCIES.md +307 -0
- django_cfg/apps/integrations/grpc/_cfg/__init__.py +25 -0
- django_cfg/apps/integrations/grpc/_cfg/check_deps.py +34 -0
- django_cfg/apps/integrations/grpc/_cfg/dependencies.py +484 -0
- django_cfg/apps/integrations/grpc/admin/__init__.py +17 -0
- django_cfg/apps/integrations/grpc/admin/config.py +261 -0
- django_cfg/apps/integrations/grpc/admin/grpc_api_key.py +129 -0
- django_cfg/apps/integrations/grpc/admin/grpc_request_log.py +261 -0
- django_cfg/apps/integrations/grpc/admin/grpc_server_status.py +236 -0
- django_cfg/apps/integrations/grpc/apps.py +108 -0
- django_cfg/apps/integrations/grpc/auth/__init__.py +17 -0
- django_cfg/apps/integrations/grpc/auth/api_key_auth.py +320 -0
- django_cfg/apps/integrations/grpc/interceptors/__init__.py +19 -0
- django_cfg/apps/integrations/grpc/interceptors/errors.py +241 -0
- django_cfg/apps/integrations/grpc/interceptors/logging.py +267 -0
- django_cfg/apps/integrations/grpc/interceptors/metrics.py +307 -0
- django_cfg/apps/integrations/grpc/interceptors/request_logger.py +535 -0
- django_cfg/apps/integrations/grpc/management/__init__.py +1 -0
- django_cfg/apps/integrations/grpc/management/commands/generate_protos.py +130 -0
- django_cfg/apps/integrations/grpc/management/commands/rungrpc.py +518 -0
- django_cfg/apps/integrations/grpc/management/commands/test_grpc_integration.py +75 -0
- django_cfg/apps/integrations/grpc/managers/__init__.py +14 -0
- django_cfg/apps/integrations/grpc/managers/grpc_api_key.py +192 -0
- django_cfg/apps/integrations/grpc/managers/grpc_request_log.py +310 -0
- django_cfg/apps/integrations/grpc/managers/grpc_server_status.py +296 -0
- django_cfg/apps/integrations/grpc/migrations/0001_initial.py +69 -0
- django_cfg/apps/integrations/grpc/migrations/0002_rename_django_cfg__service_4c4a8e_idx_django_cfg__service_584308_idx_and_more.py +38 -0
- django_cfg/apps/integrations/grpc/migrations/0003_grpcserverstatus.py +119 -0
- django_cfg/apps/integrations/grpc/migrations/0004_grpcserverstatus_registered_services.py +22 -0
- django_cfg/apps/integrations/grpc/migrations/0005_grpcapikey.py +143 -0
- django_cfg/apps/integrations/grpc/migrations/0006_grpcrequestlog_api_key_and_more.py +34 -0
- django_cfg/apps/integrations/grpc/models/__init__.py +13 -0
- django_cfg/apps/integrations/grpc/models/grpc_api_key.py +198 -0
- django_cfg/apps/integrations/grpc/models/grpc_request_log.py +230 -0
- django_cfg/apps/integrations/grpc/models/grpc_server_status.py +305 -0
- django_cfg/apps/integrations/grpc/serializers/__init__.py +83 -0
- django_cfg/apps/integrations/grpc/serializers/api_keys.py +63 -0
- django_cfg/apps/integrations/grpc/serializers/charts.py +216 -0
- django_cfg/apps/integrations/grpc/serializers/config.py +120 -0
- django_cfg/apps/integrations/grpc/serializers/health.py +18 -0
- django_cfg/apps/integrations/grpc/serializers/proto_files.py +74 -0
- django_cfg/apps/integrations/grpc/serializers/requests.py +24 -0
- django_cfg/apps/integrations/grpc/serializers/service_registry.py +260 -0
- django_cfg/apps/integrations/grpc/serializers/services.py +32 -0
- django_cfg/apps/integrations/grpc/serializers/stats.py +60 -0
- django_cfg/apps/integrations/grpc/serializers/testing.py +113 -0
- django_cfg/apps/integrations/grpc/services/__init__.py +41 -0
- django_cfg/apps/integrations/grpc/services/base.py +375 -0
- django_cfg/apps/integrations/grpc/services/chart_generator.py +475 -0
- django_cfg/apps/integrations/grpc/services/config_helper.py +146 -0
- django_cfg/apps/integrations/grpc/services/discovery.py +571 -0
- django_cfg/apps/integrations/grpc/services/grpc_client.py +590 -0
- django_cfg/apps/integrations/grpc/services/monitoring_service.py +397 -0
- django_cfg/apps/integrations/grpc/services/proto_files_manager.py +268 -0
- django_cfg/apps/integrations/grpc/services/service_registry.py +330 -0
- django_cfg/apps/integrations/grpc/services/testing_service.py +321 -0
- django_cfg/apps/integrations/grpc/testing/__init__.py +12 -0
- django_cfg/apps/integrations/grpc/testing/examples.py +263 -0
- django_cfg/apps/integrations/grpc/urls.py +47 -0
- django_cfg/apps/integrations/grpc/utils/__init__.py +9 -0
- django_cfg/apps/integrations/grpc/utils/integration_test.py +334 -0
- django_cfg/apps/integrations/grpc/utils/proto_gen.py +463 -0
- django_cfg/apps/integrations/grpc/utils/streaming_logger.py +177 -0
- django_cfg/apps/integrations/grpc/views/__init__.py +19 -0
- django_cfg/apps/integrations/grpc/views/api_keys.py +255 -0
- django_cfg/apps/integrations/grpc/views/charts.py +224 -0
- django_cfg/apps/integrations/grpc/views/config.py +193 -0
- django_cfg/apps/integrations/grpc/views/monitoring.py +360 -0
- django_cfg/apps/integrations/grpc/views/proto_files.py +214 -0
- django_cfg/apps/integrations/grpc/views/services.py +298 -0
- django_cfg/apps/integrations/grpc/views/testing.py +308 -0
- django_cfg/apps/integrations/rq/__init__.py +9 -0
- django_cfg/apps/integrations/rq/_cfg/__init__.py +28 -0
- django_cfg/apps/integrations/rq/_cfg/dependencies.py +313 -0
- django_cfg/apps/integrations/rq/apps.py +157 -0
- django_cfg/apps/integrations/rq/management/__init__.py +1 -0
- django_cfg/apps/integrations/rq/management/commands/__init__.py +1 -0
- django_cfg/apps/integrations/rq/management/commands/rqscheduler.py +31 -0
- django_cfg/apps/integrations/rq/management/commands/rqstats.py +33 -0
- django_cfg/apps/integrations/rq/management/commands/rqworker.py +31 -0
- django_cfg/apps/integrations/rq/management/commands/rqworker_pool.py +27 -0
- django_cfg/apps/integrations/rq/serializers/__init__.py +40 -0
- django_cfg/apps/integrations/rq/serializers/health.py +60 -0
- django_cfg/apps/integrations/rq/serializers/job.py +100 -0
- django_cfg/apps/integrations/rq/serializers/queue.py +80 -0
- django_cfg/apps/integrations/rq/serializers/schedule.py +178 -0
- django_cfg/apps/integrations/rq/serializers/testing.py +139 -0
- django_cfg/apps/integrations/rq/serializers/worker.py +58 -0
- django_cfg/apps/integrations/rq/services/__init__.py +25 -0
- django_cfg/apps/integrations/rq/services/config_helper.py +233 -0
- django_cfg/apps/integrations/rq/services/models/README.md +417 -0
- django_cfg/apps/integrations/rq/services/models/__init__.py +30 -0
- django_cfg/apps/integrations/rq/services/models/event.py +123 -0
- django_cfg/apps/integrations/rq/services/models/job.py +99 -0
- django_cfg/apps/integrations/rq/services/models/queue.py +92 -0
- django_cfg/apps/integrations/rq/services/models/worker.py +104 -0
- django_cfg/apps/integrations/rq/services/rq_converters.py +183 -0
- django_cfg/apps/integrations/rq/tasks/__init__.py +23 -0
- django_cfg/apps/integrations/rq/tasks/demo_tasks.py +284 -0
- django_cfg/apps/integrations/rq/urls.py +54 -0
- django_cfg/apps/integrations/rq/views/__init__.py +19 -0
- django_cfg/apps/integrations/rq/views/jobs.py +892 -0
- django_cfg/apps/integrations/rq/views/monitoring.py +248 -0
- django_cfg/apps/integrations/rq/views/queues.py +261 -0
- django_cfg/apps/integrations/rq/views/schedule.py +404 -0
- django_cfg/apps/integrations/rq/views/testing.py +761 -0
- django_cfg/apps/integrations/rq/views/workers.py +195 -0
- django_cfg/apps/system/__init__.py +0 -0
- django_cfg/apps/system/dashboard/TRANSACTION_FIX.md +73 -0
- django_cfg/apps/{dashboard → system/dashboard}/__init__.py +1 -1
- django_cfg/apps/{dashboard → system/dashboard}/apps.py +1 -1
- django_cfg/apps/{dashboard → system/dashboard}/serializers/__init__.py +4 -11
- django_cfg/apps/{dashboard → system/dashboard}/serializers/activity.py +1 -1
- django_cfg/apps/{dashboard → system/dashboard}/serializers/commands.py +25 -1
- django_cfg/apps/system/dashboard/serializers/config.py +245 -0
- django_cfg/apps/{dashboard → system/dashboard}/services/__init__.py +2 -2
- django_cfg/apps/{dashboard → system/dashboard}/services/charts_service.py +4 -3
- django_cfg/apps/{dashboard → system/dashboard}/services/commands_service.py +12 -1
- django_cfg/apps/system/dashboard/services/config_service.py +393 -0
- django_cfg/apps/{dashboard → system/dashboard}/services/statistics_service.py +11 -2
- django_cfg/apps/{dashboard → system/dashboard}/services/system_health_service.py +64 -106
- django_cfg/apps/{dashboard → system/dashboard}/urls.py +3 -2
- django_cfg/apps/{dashboard → system/dashboard}/views/__init__.py +2 -2
- django_cfg/apps/{dashboard → system/dashboard}/views/commands_views.py +3 -6
- django_cfg/apps/system/dashboard/views/config_views.py +69 -0
- django_cfg/apps/{dashboard → system/dashboard}/views/overview_views.py +14 -13
- django_cfg/apps/{frontend → system/frontend}/__init__.py +1 -1
- django_cfg/apps/{frontend → system/frontend}/apps.py +1 -1
- django_cfg/apps/{frontend → system/frontend}/setup.py +5 -5
- django_cfg/apps/{frontend → system/frontend}/views.py +18 -3
- django_cfg/apps/system/maintenance/__init__.py +56 -0
- django_cfg/apps/{maintenance → system/maintenance}/admin/api_key_admin.py +10 -12
- django_cfg/apps/{maintenance → system/maintenance}/admin/scheduled_admin.py +3 -3
- django_cfg/apps/{maintenance → system/maintenance}/admin/site_admin.py +10 -9
- django_cfg/apps/{maintenance → system/maintenance}/apps.py +1 -1
- django_cfg/apps/system/maintenance/management/__init__.py +0 -0
- django_cfg/apps/system/maintenance/management/commands/__init__.py +0 -0
- django_cfg/apps/{maintenance → system/maintenance}/management/commands/maintenance.py +5 -2
- django_cfg/apps/{maintenance → system/maintenance}/management/commands/process_scheduled_maintenance.py +4 -2
- django_cfg/apps/{maintenance → system/maintenance}/management/commands/sync_cloudflare.py +5 -2
- django_cfg/apps/system/maintenance/migrations/__init__.py +0 -0
- django_cfg/apps/{maintenance → system/maintenance}/models/__init__.py +4 -4
- django_cfg/apps/system/maintenance/services/__init__.py +42 -0
- django_cfg/apps/urls.py +54 -115
- django_cfg/config.py +36 -0
- django_cfg/core/base/config_model.py +27 -28
- django_cfg/core/builders/apps_builder.py +19 -21
- django_cfg/core/constants.py +1 -0
- django_cfg/core/debug/README.md +116 -0
- django_cfg/core/debug/__init__.py +7 -0
- django_cfg/core/debug/example_config.py +63 -0
- django_cfg/core/debug/warnings_helper.py +121 -0
- django_cfg/core/generation/integration_generators/__init__.py +3 -6
- django_cfg/core/generation/integration_generators/django_rq.py +80 -0
- django_cfg/core/generation/integration_generators/grpc_generator.py +316 -0
- django_cfg/core/generation/orchestrator.py +15 -15
- django_cfg/core/integration/display/__init__.py +2 -0
- django_cfg/core/integration/display/base.py +51 -0
- django_cfg/core/integration/display/grpc_display.py +144 -0
- django_cfg/core/integration/display/startup.py +24 -58
- django_cfg/management/commands/check_endpoints.py +2 -2
- django_cfg/management/commands/check_settings.py +3 -10
- django_cfg/management/commands/clear_constance.py +3 -10
- django_cfg/management/commands/create_token.py +4 -11
- django_cfg/management/commands/list_urls.py +4 -10
- django_cfg/management/commands/migrate_all.py +18 -12
- django_cfg/management/commands/migrator.py +4 -11
- django_cfg/management/commands/script.py +4 -10
- django_cfg/management/commands/show_config.py +8 -16
- django_cfg/management/commands/show_urls.py +5 -11
- django_cfg/management/commands/superuser.py +4 -11
- django_cfg/management/commands/tree.py +5 -10
- django_cfg/management/utils/README.md +402 -0
- django_cfg/management/utils/__init__.py +29 -0
- django_cfg/management/utils/mixins.py +176 -0
- django_cfg/middleware/authentication.py +1 -1
- django_cfg/middleware/pagination.py +53 -54
- django_cfg/mixins/__init__.py +2 -0
- django_cfg/mixins/superadmin_api.py +59 -0
- django_cfg/models/__init__.py +3 -3
- django_cfg/models/api/grpc/__init__.py +53 -0
- django_cfg/models/api/grpc/config.py +446 -0
- django_cfg/models/django/__init__.py +3 -3
- django_cfg/models/django/constance.py +1 -1
- django_cfg/models/django/django_rq.py +632 -0
- django_cfg/models/django/revolution_legacy.py +8 -8
- django_cfg/models/ngrok/config.py +7 -6
- django_cfg/modules/base.py +19 -6
- django_cfg/modules/django_admin/__init__.py +2 -0
- django_cfg/modules/django_admin/apps.py +19 -0
- django_cfg/modules/django_admin/base/pydantic_admin.py +23 -12
- django_cfg/modules/django_admin/config/__init__.py +2 -0
- django_cfg/modules/django_admin/config/admin_config.py +7 -0
- django_cfg/modules/django_admin/config/background_task_config.py +4 -4
- django_cfg/modules/django_admin/config/field_config.py +24 -0
- django_cfg/modules/django_admin/templates/django_admin/widgets/encrypted_field.html +80 -0
- django_cfg/modules/django_admin/templates/django_admin/widgets/encrypted_password.html +62 -0
- django_cfg/modules/django_admin/utils/__init__.py +41 -3
- django_cfg/modules/django_admin/utils/badges/__init__.py +13 -0
- django_cfg/modules/django_admin/utils/{badges.py → badges/status_badges.py} +3 -3
- django_cfg/modules/django_admin/utils/displays/__init__.py +13 -0
- django_cfg/modules/django_admin/utils/{displays.py → displays/data_displays.py} +2 -2
- django_cfg/modules/django_admin/utils/html/__init__.py +26 -0
- django_cfg/modules/django_admin/utils/html/badges.py +55 -0
- django_cfg/modules/django_admin/utils/html/base.py +167 -0
- django_cfg/modules/django_admin/utils/html/code.py +87 -0
- django_cfg/modules/django_admin/utils/html/composition.py +205 -0
- django_cfg/modules/django_admin/utils/html/formatting.py +231 -0
- django_cfg/modules/django_admin/utils/html/keyvalue.py +219 -0
- django_cfg/modules/django_admin/utils/html/markdown_integration.py +108 -0
- django_cfg/modules/django_admin/utils/html/progress.py +127 -0
- django_cfg/modules/django_admin/utils/html_builder.py +55 -408
- django_cfg/modules/django_admin/utils/markdown/__init__.py +21 -0
- django_cfg/modules/django_admin/widgets/__init__.py +3 -0
- django_cfg/modules/django_admin/widgets/encrypted_field_widget.py +66 -0
- django_cfg/modules/django_admin/widgets/registry.py +42 -0
- django_cfg/modules/django_client/core/generator/python/files_generator.py +5 -13
- django_cfg/modules/django_client/core/generator/python/templates/api_wrapper.py.jinja +16 -4
- django_cfg/modules/django_client/core/generator/python/templates/main_init.py.jinja +2 -3
- django_cfg/modules/django_client/core/generator/typescript/files_generator.py +6 -5
- django_cfg/modules/django_client/core/generator/typescript/operations_generator.py +13 -4
- django_cfg/modules/django_client/core/generator/typescript/templates/main_index.ts.jinja +12 -8
- django_cfg/modules/django_client/core/parser/base.py +135 -2
- django_cfg/modules/django_client/management/commands/generate_client.py +5 -2
- django_cfg/modules/django_client/management/commands/validate_openapi.py +5 -2
- django_cfg/modules/django_currency/examples/example_database_usage.py +1 -1
- django_cfg/modules/django_email/management/commands/test_email.py +4 -10
- django_cfg/modules/django_logging/__init__.py +2 -0
- django_cfg/modules/django_logging/django_logger.py +78 -8
- django_cfg/modules/django_ngrok/management/commands/runserver_ngrok.py +16 -13
- django_cfg/modules/django_telegram/management/commands/test_telegram.py +4 -11
- django_cfg/modules/django_twilio/management/commands/test_twilio.py +4 -11
- django_cfg/modules/django_twilio/sendgrid_service.py +1 -1
- django_cfg/modules/django_unfold/navigation.py +15 -24
- django_cfg/modules/nextjs_admin/views.py +1 -1
- django_cfg/pyproject.toml +10 -10
- django_cfg/registry/core.py +4 -7
- django_cfg/registry/modules.py +4 -1
- django_cfg/requirements.txt +52 -0
- django_cfg/static/frontend/admin.zip +0 -0
- django_cfg/templates/admin/constance/includes/results_list.html +73 -0
- django_cfg/templates/admin/index.html +187 -62
- django_cfg/templatetags/django_cfg.py +61 -1
- {django_cfg-1.4.116.dist-info → django_cfg-1.5.14.dist-info}/METADATA +106 -60
- django_cfg-1.5.14.dist-info/RECORD +1182 -0
- django_cfg/apps/centrifugo/apps.py +0 -31
- django_cfg/apps/centrifugo/serializers/publishes.py +0 -18
- django_cfg/apps/dashboard/permissions.py +0 -48
- django_cfg/apps/dashboard/serializers/django_q2.py +0 -50
- django_cfg/apps/dashboard/services/django_q2_service.py +0 -159
- django_cfg/apps/dashboard/views/django_q2_views.py +0 -79
- django_cfg/apps/knowbase/examples/__init__.py +0 -3
- django_cfg/apps/maintenance/__init__.py +0 -56
- django_cfg/apps/maintenance/services/__init__.py +0 -42
- django_cfg/apps/tasks/__init__.py +0 -64
- django_cfg/apps/tasks/admin/__init__.py +0 -4
- django_cfg/apps/tasks/admin/config.py +0 -98
- django_cfg/apps/tasks/admin/task_log.py +0 -265
- django_cfg/apps/tasks/apps.py +0 -15
- django_cfg/apps/tasks/filters/__init__.py +0 -10
- django_cfg/apps/tasks/filters/task_log.py +0 -121
- django_cfg/apps/tasks/migrations/0001_initial.py +0 -196
- django_cfg/apps/tasks/migrations/0002_delete_tasklog.py +0 -16
- django_cfg/apps/tasks/models/__init__.py +0 -4
- django_cfg/apps/tasks/models/task_log.py +0 -246
- django_cfg/apps/tasks/serializers/__init__.py +0 -28
- django_cfg/apps/tasks/serializers/task_log.py +0 -249
- django_cfg/apps/tasks/services/__init__.py +0 -10
- django_cfg/apps/tasks/services/client/__init__.py +0 -7
- django_cfg/apps/tasks/services/client/client.py +0 -234
- django_cfg/apps/tasks/services/config_helper.py +0 -63
- django_cfg/apps/tasks/services/sync.py +0 -204
- django_cfg/apps/tasks/urls.py +0 -16
- django_cfg/apps/tasks/views/__init__.py +0 -10
- django_cfg/apps/tasks/views/task_log.py +0 -41
- django_cfg/apps/tasks/views/task_log_base.py +0 -41
- django_cfg/apps/tasks/views/task_log_overview.py +0 -100
- django_cfg/apps/tasks/views/task_log_related.py +0 -41
- django_cfg/apps/tasks/views/task_log_stats.py +0 -91
- django_cfg/apps/tasks/views/task_log_timeline.py +0 -81
- django_cfg/core/generation/integration_generators/django_q2.py +0 -133
- django_cfg/core/generation/integration_generators/tasks.py +0 -88
- django_cfg/models/django/django_q2.py +0 -496
- django_cfg/models/tasks/__init__.py +0 -49
- django_cfg/models/tasks/backends.py +0 -122
- django_cfg/models/tasks/config.py +0 -209
- django_cfg/models/tasks/utils.py +0 -162
- django_cfg/modules/django_admin/utils/CODE_BLOCK_DOCS.md +0 -396
- django_cfg/modules/django_logging/FIXES_SUMMARY.md +0 -276
- django_cfg/modules/django_logging/LOGGING_GUIDE.md +0 -504
- django_cfg-1.4.116.dist-info/RECORD +0 -1068
- /django_cfg/apps/{accounts/migrations → business}/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/README.md +0 -0
- /django_cfg/apps/{accounts → business/accounts}/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/__models.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/activity_admin.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/filters.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/group_admin.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/otp_admin.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/registration_admin.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/resources.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/admin/twilio_admin.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/managers/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/migrations/0002_add_phone_otp_clean.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/migrations/0003_twilioresponse.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/migrations/0004_delete_twilioresponse.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/migrations/0005_twilioresponse.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/migrations/0006_remove_twilioresponse_otp_secret_and_more.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/migrations/0007_twilioresponse.py +0 -0
- /django_cfg/apps/{knowbase/management → business/accounts/migrations}/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/activity.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/auth.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/base.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/choices.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/integrations.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/registration.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/models/user.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/serializers/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/serializers/otp.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/serializers/profile.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/serializers/webhook.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/services/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/services/activity_service.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/services/otp_service.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/signals.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/templates/emails/base_email.html +0 -0
- /django_cfg/apps/{accounts → business/accounts}/templates/emails/base_email.txt +0 -0
- /django_cfg/apps/{accounts → business/accounts}/templates/emails/otp_email.html +0 -0
- /django_cfg/apps/{accounts → business/accounts}/templates/emails/otp_email.txt +0 -0
- /django_cfg/apps/{accounts → business/accounts}/templates/emails/welcome_email.html +0 -0
- /django_cfg/apps/{accounts → business/accounts}/templates/emails/welcome_email.txt +0 -0
- /django_cfg/apps/{accounts → business/accounts}/urls.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/urls_admin.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/utils/notifications.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/views/__init__.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/views/otp.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/views/profile.py +0 -0
- /django_cfg/apps/{accounts → business/accounts}/views/webhook.py +0 -0
- /django_cfg/apps/{agents → business/agents}/README.md +0 -0
- /django_cfg/apps/{agents → business/agents}/admin/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/admin/execution_actions.py +0 -0
- /django_cfg/apps/{agents → business/agents}/admin/execution_admin.py +0 -0
- /django_cfg/apps/{agents → business/agents}/admin/registry_actions.py +0 -0
- /django_cfg/apps/{agents → business/agents}/admin/registry_admin.py +0 -0
- /django_cfg/apps/{agents → business/agents}/admin/toolsets_actions.py +0 -0
- /django_cfg/apps/{agents → business/agents}/admin/toolsets_admin.py +0 -0
- /django_cfg/apps/{agents → business/agents}/core/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/core/dependencies.py +0 -0
- /django_cfg/apps/{agents → business/agents}/core/django_agent.py +0 -0
- /django_cfg/apps/{agents → business/agents}/core/exceptions.py +0 -0
- /django_cfg/apps/{agents → business/agents}/core/models.py +0 -0
- /django_cfg/apps/{agents → business/agents}/core/orchestrator.py +0 -0
- /django_cfg/apps/{agents → business/agents}/examples/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/examples/simple_example.py +0 -0
- /django_cfg/apps/{agents → business/agents}/integration/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/integration/middleware.py +0 -0
- /django_cfg/apps/{agents → business/agents}/integration/registry.py +0 -0
- /django_cfg/apps/{agents → business/agents}/integration/signals.py +0 -0
- /django_cfg/apps/{agents → business/agents}/management/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/management/commands/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/managers/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/managers/execution.py +0 -0
- /django_cfg/apps/{agents → business/agents}/managers/registry.py +0 -0
- /django_cfg/apps/{agents → business/agents}/managers/toolsets.py +0 -0
- /django_cfg/apps/{agents → business/agents}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{agents → business/agents}/migrations/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/models/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/models/execution.py +0 -0
- /django_cfg/apps/{agents → business/agents}/models/registry.py +0 -0
- /django_cfg/apps/{agents → business/agents}/models/toolsets.py +0 -0
- /django_cfg/apps/{agents → business/agents}/patterns/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/patterns/content_agents.py +0 -0
- /django_cfg/apps/{agents → business/agents}/toolsets/__init__.py +0 -0
- /django_cfg/apps/{agents → business/agents}/toolsets/cache_toolset.py +0 -0
- /django_cfg/apps/{agents → business/agents}/toolsets/django_toolset.py +0 -0
- /django_cfg/apps/{agents → business/agents}/toolsets/file_toolset.py +0 -0
- /django_cfg/apps/{agents → business/agents}/toolsets/orm_toolset.py +0 -0
- /django_cfg/apps/{agents → business/agents}/urls.py +0 -0
- /django_cfg/apps/{agents → business/agents}/urls_admin.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/README.md +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/archive_actions.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/archive_admin.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/chat_actions.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/chat_admin.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/document_actions.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/document_admin.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/external_data_actions.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/admin/external_data_admin.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/config/README.md +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/config/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/config/constance_fields.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/config/constance_settings.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/config/settings.py +0 -0
- /django_cfg/apps/{knowbase/management/commands → business/knowbase/management}/__init__.py +0 -0
- /django_cfg/apps/{leads → business/knowbase/management/commands}/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/managers/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/managers/archive.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/managers/base.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/managers/chat.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/managers/document.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/managers/external_data.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/migrations/0002_archiveitem_archiveitemchunk_documentarchive_and_more.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/migrations/0003_alter_documentarchive_archive_type.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/migrations/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/config/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/config/defaults.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/config/meta_config.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/config.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/creator.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/external_data_mixin.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/generators/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/generators/content_generator.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/generators/field_analyzer.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/mixins/generators/metadata_generator.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/models/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/models/archive.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/models/base.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/models/chat.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/models/document.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/serializers/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/serializers/archive_serializers.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/serializers/chat_serializers.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/serializers/document_serializers.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/serializers/external_data_serializers.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/serializers/public_serializers.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/analyzers/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/analyzers/complexity_analyzer.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/analyzers/purpose_detector.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/analyzers/quality_analyzer.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/analyzers/tag_generator.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/archive_service.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/chunking/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/chunking/base.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/chunking/json_chunker.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/chunking/markdown_chunker.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/chunking/python_chunker.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/chunking/text_chunker.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/chunking_service.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/context/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/context/builders.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/context/models.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/exceptions.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/archive/extraction_service.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/base.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/chat_service.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/document_service.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/embedding/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/embedding/batch_result.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/embedding/models.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/prompt_builder.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/services/search_service.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/signals/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/signals/archive_signals.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/signals/chat_signals.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/signals/document_signals.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/signals/external_data_signals.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/tasks/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/tasks/archive_tasks.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/tasks/external_data_tasks.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/tasks/maintenance.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/urls.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/urls_admin.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/urls_system.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/utils/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/utils/text_processing.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/utils/validation.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/views/__init__.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/views/base.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/views/chat_views.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/views/document_views.py +0 -0
- /django_cfg/apps/{knowbase → business/knowbase}/views/public_views.py +0 -0
- /django_cfg/apps/{leads → business/leads}/README.md +0 -0
- /django_cfg/apps/{leads/migrations → business/leads}/__init__.py +0 -0
- /django_cfg/apps/{leads → business/leads}/admin/__init__.py +0 -0
- /django_cfg/apps/{leads → business/leads}/admin/actions.py +0 -0
- /django_cfg/apps/{leads → business/leads}/admin/leads_admin.py +0 -0
- /django_cfg/apps/{leads → business/leads}/admin/resources.py +0 -0
- /django_cfg/apps/{leads → business/leads}/admin.py +0 -0
- /django_cfg/apps/{leads → business/leads}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{maintenance/management → business/leads/migrations}/__init__.py +0 -0
- /django_cfg/apps/{leads → business/leads}/models.py +0 -0
- /django_cfg/apps/{leads → business/leads}/serializers.py +0 -0
- /django_cfg/apps/{leads → business/leads}/signals.py +0 -0
- /django_cfg/apps/{leads → business/leads}/tests.py +0 -0
- /django_cfg/apps/{leads → business/leads}/urls.py +0 -0
- /django_cfg/apps/{leads → business/leads}/urls_admin.py +0 -0
- /django_cfg/apps/{leads → business/leads}/views.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/README.md +0 -0
- /django_cfg/apps/{maintenance/management/commands → business/newsletter}/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/admin/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/admin/actions.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/admin/filters.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/admin/resources.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/admin.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/admin_filters.py +0 -0
- /django_cfg/apps/{maintenance/migrations → business/newsletter/management}/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter/management/commands}/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/managers/README.md +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/managers/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{newsletter/management → business/newsletter/migrations}/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/models.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/serializers.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/services/email_service.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/signals.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/urls.py +0 -0
- /django_cfg/apps/{maintenance → business/newsletter}/urls_admin.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/utils/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/views/__init__.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/views/campaigns.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/views/emails.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/views/newsletters.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/views/subscriptions.py +0 -0
- /django_cfg/apps/{newsletter → business/newsletter}/views/tracking.py +0 -0
- /django_cfg/apps/{payments → business/payments}/CONFIGURATION.md +0 -0
- /django_cfg/apps/{payments → business/payments}/admin/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/admin/actions.py +0 -0
- /django_cfg/apps/{payments → business/payments}/admin/balance_actions.py +0 -0
- /django_cfg/apps/{payments → business/payments}/admin/currency_admin.py +0 -0
- /django_cfg/apps/{payments → business/payments}/admin/filters.py +0 -0
- /django_cfg/apps/{payments → business/payments}/admin/payment_actions.py +0 -0
- /django_cfg/apps/{payments → business/payments}/admin/withdrawal_actions.py +0 -0
- /django_cfg/apps/{payments → business/payments}/api/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/api/serializers.py +0 -0
- /django_cfg/apps/{payments → business/payments}/api/urls.py +0 -0
- /django_cfg/apps/{payments → business/payments}/api/views.py +0 -0
- /django_cfg/apps/{payments → business/payments}/config.py +0 -0
- /django_cfg/apps/{payments → business/payments}/management/README.md +0 -0
- /django_cfg/apps/{newsletter/management/commands → business/payments/management}/__init__.py +0 -0
- /django_cfg/apps/{newsletter/migrations → business/payments/management/commands}/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{payments/management → business/payments/migrations}/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/balance.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/base.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/currency.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/managers/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/managers/balance_managers.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/managers/payment_managers.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/payment.py +0 -0
- /django_cfg/apps/{payments → business/payments}/models/withdrawal.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/balance_service.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/payment_service.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/providers/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/providers/models.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/providers/nowpayments/__init__.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/providers/nowpayments/config.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/providers/nowpayments/parser.py +0 -0
- /django_cfg/apps/{payments → business/payments}/services/providers/nowpayments/provider.py +0 -0
- /django_cfg/apps/{payments/management/commands → business/support}/__init__.py +0 -0
- /django_cfg/apps/{support → business/support}/admin/__init__.py +0 -0
- /django_cfg/apps/{support → business/support}/admin/actions.py +0 -0
- /django_cfg/apps/{support → business/support}/admin/filters.py +0 -0
- /django_cfg/apps/{support → business/support}/admin/resources.py +0 -0
- /django_cfg/apps/{support → business/support}/admin/support_admin.py +0 -0
- /django_cfg/apps/{support → business/support}/admin.py +0 -0
- /django_cfg/apps/{support → business/support}/admin_filters.py +0 -0
- /django_cfg/apps/{support → business/support}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{support → business/support}/migrations/0002_alter_message_ticket.py +0 -0
- /django_cfg/apps/{payments → business/support}/migrations/__init__.py +0 -0
- /django_cfg/apps/{support → business/support}/models.py +0 -0
- /django_cfg/apps/{support → business/support}/serializers.py +0 -0
- /django_cfg/apps/{support → business/support}/signals.py +0 -0
- /django_cfg/apps/{support → business/support}/templates/support/chat/access_denied.html +0 -0
- /django_cfg/apps/{support → business/support}/templates/support/chat/ticket_chat.html +0 -0
- /django_cfg/apps/{support → business/support}/urls.py +0 -0
- /django_cfg/apps/{newsletter → business/support}/urls_admin.py +0 -0
- /django_cfg/apps/{support → business/support/utils}/__init__.py +0 -0
- /django_cfg/apps/{support → business/support}/utils/support_email_service.py +0 -0
- /django_cfg/apps/{support → business/support}/views/__init__.py +0 -0
- /django_cfg/apps/{support → business/support}/views/admin.py +0 -0
- /django_cfg/apps/{support → business/support}/views/api.py +0 -0
- /django_cfg/apps/{support → business/support}/views/chat.py +0 -0
- /django_cfg/apps/{support/migrations → integrations}/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/admin/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/admin/config.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/IMPLEMENTATION_SUMMARY.md +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/README.md +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/USAGE.md +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/discovery.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/generator.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/templates/README.md.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/templates/client.go.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/templates/go.mod.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/templates/rpc_client.go.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/templates/rpc_client.go.j2.old +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/go_thin/templates/types.go.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/generator.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/templates/README.md.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/templates/__init__.py.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/templates/client.py.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/templates/models.py.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/templates/requirements.txt.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/python_thin/templates/rpc_client.py.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/generator.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/templates/README.md.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/templates/client.ts.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/templates/index.ts.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/templates/package.json.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/templates/rpc-client.ts.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/templates/tsconfig.json.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/generators/typescript_thin/templates/types.ts.j2 +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/utils/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/utils/naming.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/codegen/utils/type_converter.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/decorators.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/management/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/management/commands/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/managers/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/managers/centrifugo_log.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/migrations/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/models/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/models/centrifugo_log.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/registry.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/router.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/serializers/admin_api.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/serializers/channels.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/serializers/health.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/services/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/services/client/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/services/client/exceptions.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/services/config_helper.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/services/dashboard_notifier.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/services/logging.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/urls.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/views/__init__.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/views/admin_api.py +0 -0
- /django_cfg/apps/{centrifugo → integrations/centrifugo}/views/testing_api.py +0 -0
- /django_cfg/apps/{support/utils → integrations/grpc/management/commands}/__init__.py +0 -0
- /django_cfg/apps/{tasks → integrations/grpc}/migrations/__init__.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/serializers/apizones.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/serializers/base.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/serializers/charts.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/serializers/overview.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/serializers/statistics.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/serializers/system.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/services/apizones_service.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/services/commands_security.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/services/overview_service.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/views/activity_views.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/views/apizones_views.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/views/charts_views.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/views/statistics_views.py +0 -0
- /django_cfg/apps/{dashboard → system/dashboard}/views/system_views.py +0 -0
- /django_cfg/apps/{frontend → system/frontend}/JWT_AUTO_INJECTION.md +0 -0
- /django_cfg/apps/{frontend → system/frontend}/templates/frontend/404.html +0 -0
- /django_cfg/apps/{frontend → system/frontend}/test_routing.py +0 -0
- /django_cfg/apps/{frontend → system/frontend}/urls.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/admin/__init__.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/admin/actions.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/admin/log_admin.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/managers/__init__.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/managers/cloudflare_site_manager.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/managers/maintenance_log_manager.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/migrations/0001_initial.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/migrations/0002_cloudflaresite_maintenance_url.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/migrations/0003_cloudflaresite_include_subdomains_and_more.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/models/cloudflare_api_key.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/models/cloudflare_site.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/models/maintenance_log.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/models/scheduled_maintenance.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/services/bulk_operations_service.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/services/maintenance_service.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/services/scheduled_maintenance_service.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/services/site_sync_service.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/urls.py +0 -0
- /django_cfg/apps/{support → system/maintenance}/urls_admin.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/utils/__init__.py +0 -0
- /django_cfg/apps/{maintenance → system/maintenance}/utils/retry_utils.py +0 -0
- /django_cfg/modules/django_admin/utils/{mermaid_plugin.py → markdown/mermaid_plugin.py} +0 -0
- /django_cfg/modules/django_admin/utils/{markdown_renderer.py → markdown/renderer.py} +0 -0
- {django_cfg-1.4.116.dist-info → django_cfg-1.5.14.dist-info}/WHEEL +0 -0
- {django_cfg-1.4.116.dist-info → django_cfg-1.5.14.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.4.116.dist-info → django_cfg-1.5.14.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Request Logger Interceptor for gRPC.
|
|
3
|
+
|
|
4
|
+
Automatically logs all gRPC requests to the database for monitoring.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import asyncio
|
|
10
|
+
import logging
|
|
11
|
+
import time
|
|
12
|
+
import uuid
|
|
13
|
+
from typing import Callable
|
|
14
|
+
|
|
15
|
+
import grpc
|
|
16
|
+
import grpc.aio
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class RequestLoggerInterceptor(grpc.aio.ServerInterceptor):
|
|
22
|
+
"""
|
|
23
|
+
gRPC interceptor for request logging to database (async).
|
|
24
|
+
|
|
25
|
+
Features:
|
|
26
|
+
- Logs all requests to GRPCRequestLog model
|
|
27
|
+
- Captures timing, status, and error information
|
|
28
|
+
- Links requests to authenticated users
|
|
29
|
+
- Captures client metadata
|
|
30
|
+
- Tracks request/response sizes
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
```python
|
|
34
|
+
# In Django settings (auto-configured)
|
|
35
|
+
GRPC_FRAMEWORK = {
|
|
36
|
+
"SERVER_INTERCEPTORS": [
|
|
37
|
+
"django_cfg.apps.integrations.grpc.interceptors.RequestLoggerInterceptor",
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Database Schema:
|
|
43
|
+
All requests are logged to GRPCRequestLog model.
|
|
44
|
+
Use admin interface or REST API to view logs.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __init__(self, log_request_data: bool = False, log_response_data: bool = False):
|
|
48
|
+
"""
|
|
49
|
+
Initialize request logger.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
log_request_data: Whether to log request data (default: False)
|
|
53
|
+
log_response_data: Whether to log response data (default: False)
|
|
54
|
+
"""
|
|
55
|
+
self.log_request_data = log_request_data
|
|
56
|
+
self.log_response_data = log_response_data
|
|
57
|
+
|
|
58
|
+
async def intercept_service(
|
|
59
|
+
self,
|
|
60
|
+
continuation: Callable,
|
|
61
|
+
handler_call_details: grpc.HandlerCallDetails,
|
|
62
|
+
) -> grpc.RpcMethodHandler:
|
|
63
|
+
"""
|
|
64
|
+
Intercept gRPC service call for logging (async).
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
continuation: Function to invoke the next interceptor or handler
|
|
68
|
+
handler_call_details: Details about the RPC call
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
RPC method handler with logging
|
|
72
|
+
"""
|
|
73
|
+
# Generate unique request ID
|
|
74
|
+
request_id = str(uuid.uuid4())
|
|
75
|
+
|
|
76
|
+
# Extract method info
|
|
77
|
+
full_method = handler_call_details.method
|
|
78
|
+
service_name, method_name = self._parse_method(full_method)
|
|
79
|
+
|
|
80
|
+
# Extract client metadata
|
|
81
|
+
metadata_dict = dict(handler_call_details.invocation_metadata)
|
|
82
|
+
peer = metadata_dict.get("peer", "unknown")
|
|
83
|
+
user_agent = metadata_dict.get("user-agent", None)
|
|
84
|
+
|
|
85
|
+
# Get handler and wrap it (await for async)
|
|
86
|
+
handler = await continuation(handler_call_details)
|
|
87
|
+
|
|
88
|
+
if handler is None:
|
|
89
|
+
logger.warning(f"[gRPC Logger] No handler found for {full_method}")
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
# Wrap handler methods to log to database
|
|
93
|
+
return self._wrap_handler(
|
|
94
|
+
handler,
|
|
95
|
+
request_id,
|
|
96
|
+
service_name,
|
|
97
|
+
method_name,
|
|
98
|
+
full_method,
|
|
99
|
+
peer,
|
|
100
|
+
user_agent,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
def _wrap_handler(
|
|
104
|
+
self,
|
|
105
|
+
handler: grpc.RpcMethodHandler,
|
|
106
|
+
request_id: str,
|
|
107
|
+
service_name: str,
|
|
108
|
+
method_name: str,
|
|
109
|
+
full_method: str,
|
|
110
|
+
peer: str,
|
|
111
|
+
user_agent: str,
|
|
112
|
+
) -> grpc.RpcMethodHandler:
|
|
113
|
+
"""
|
|
114
|
+
Wrap handler to add database logging.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
handler: Original RPC method handler
|
|
118
|
+
request_id: Unique request ID
|
|
119
|
+
service_name: Service name
|
|
120
|
+
method_name: Method name
|
|
121
|
+
full_method: Full method path
|
|
122
|
+
peer: Client peer
|
|
123
|
+
user_agent: User agent
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
Wrapped RPC method handler
|
|
127
|
+
"""
|
|
128
|
+
def wrap_unary_unary(behavior):
|
|
129
|
+
async def wrapper(request, context):
|
|
130
|
+
start_time = time.time()
|
|
131
|
+
|
|
132
|
+
# Create log entry (async)
|
|
133
|
+
log_entry = await self._create_log_entry_async(
|
|
134
|
+
request_id=request_id,
|
|
135
|
+
service_name=service_name,
|
|
136
|
+
method_name=method_name,
|
|
137
|
+
full_method=full_method,
|
|
138
|
+
peer=peer,
|
|
139
|
+
user_agent=user_agent,
|
|
140
|
+
context=context,
|
|
141
|
+
request=request if self.log_request_data else None,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
try:
|
|
145
|
+
response = await behavior(request, context)
|
|
146
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
147
|
+
|
|
148
|
+
# Mark as successful (async)
|
|
149
|
+
await self._mark_success_async(
|
|
150
|
+
log_entry,
|
|
151
|
+
duration_ms=duration_ms,
|
|
152
|
+
response=response if self.log_response_data else None,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
return response
|
|
156
|
+
except Exception as e:
|
|
157
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
158
|
+
|
|
159
|
+
# Mark as error (async)
|
|
160
|
+
await self._mark_error_async(
|
|
161
|
+
log_entry,
|
|
162
|
+
error=e,
|
|
163
|
+
context=context,
|
|
164
|
+
duration_ms=duration_ms,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
raise
|
|
168
|
+
|
|
169
|
+
return wrapper
|
|
170
|
+
|
|
171
|
+
def wrap_unary_stream(behavior):
|
|
172
|
+
async def wrapper(request, context):
|
|
173
|
+
start_time = time.time()
|
|
174
|
+
|
|
175
|
+
# Create log entry (async)
|
|
176
|
+
log_entry = await self._create_log_entry_async(
|
|
177
|
+
request_id=request_id,
|
|
178
|
+
service_name=service_name,
|
|
179
|
+
method_name=method_name,
|
|
180
|
+
full_method=full_method,
|
|
181
|
+
peer=peer,
|
|
182
|
+
user_agent=user_agent,
|
|
183
|
+
context=context,
|
|
184
|
+
request=request if self.log_request_data else None,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
try:
|
|
188
|
+
response_count = 0
|
|
189
|
+
async for response in behavior(request, context):
|
|
190
|
+
response_count += 1
|
|
191
|
+
yield response
|
|
192
|
+
|
|
193
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
194
|
+
|
|
195
|
+
# Mark as successful (async)
|
|
196
|
+
await self._mark_success_async(
|
|
197
|
+
log_entry,
|
|
198
|
+
duration_ms=duration_ms,
|
|
199
|
+
response_data={"message_count": response_count} if not self.log_response_data else None,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
except Exception as e:
|
|
203
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
204
|
+
|
|
205
|
+
# Mark as error (async)
|
|
206
|
+
await self._mark_error_async(
|
|
207
|
+
log_entry,
|
|
208
|
+
error=e,
|
|
209
|
+
context=context,
|
|
210
|
+
duration_ms=duration_ms,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
raise
|
|
214
|
+
|
|
215
|
+
return wrapper
|
|
216
|
+
|
|
217
|
+
def wrap_stream_unary(behavior):
|
|
218
|
+
async def wrapper(request_iterator, context):
|
|
219
|
+
start_time = time.time()
|
|
220
|
+
|
|
221
|
+
# Create log entry (async)
|
|
222
|
+
log_entry = await self._create_log_entry_async(
|
|
223
|
+
request_id=request_id,
|
|
224
|
+
service_name=service_name,
|
|
225
|
+
method_name=method_name,
|
|
226
|
+
full_method=full_method,
|
|
227
|
+
peer=peer,
|
|
228
|
+
user_agent=user_agent,
|
|
229
|
+
context=context,
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
try:
|
|
233
|
+
# Count requests (async for)
|
|
234
|
+
requests = []
|
|
235
|
+
request_count = 0
|
|
236
|
+
async for req in request_iterator:
|
|
237
|
+
request_count += 1
|
|
238
|
+
requests.append(req)
|
|
239
|
+
|
|
240
|
+
# Process (create async generator)
|
|
241
|
+
async def async_iter():
|
|
242
|
+
for r in requests:
|
|
243
|
+
yield r
|
|
244
|
+
|
|
245
|
+
response = await behavior(async_iter(), context)
|
|
246
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
247
|
+
|
|
248
|
+
# Mark as successful (async)
|
|
249
|
+
await self._mark_success_async(
|
|
250
|
+
log_entry,
|
|
251
|
+
duration_ms=duration_ms,
|
|
252
|
+
request_data={"message_count": request_count} if not self.log_request_data else None,
|
|
253
|
+
response=response if self.log_response_data else None,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
return response
|
|
257
|
+
except Exception as e:
|
|
258
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
259
|
+
|
|
260
|
+
# Mark as error (async)
|
|
261
|
+
await self._mark_error_async(
|
|
262
|
+
log_entry,
|
|
263
|
+
error=e,
|
|
264
|
+
context=context,
|
|
265
|
+
duration_ms=duration_ms,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
raise
|
|
269
|
+
|
|
270
|
+
return wrapper
|
|
271
|
+
|
|
272
|
+
def wrap_stream_stream(behavior):
|
|
273
|
+
async def wrapper(request_iterator, context):
|
|
274
|
+
start_time = time.time()
|
|
275
|
+
|
|
276
|
+
# Create log entry (async)
|
|
277
|
+
log_entry = await self._create_log_entry_async(
|
|
278
|
+
request_id=request_id,
|
|
279
|
+
service_name=service_name,
|
|
280
|
+
method_name=method_name,
|
|
281
|
+
full_method=full_method,
|
|
282
|
+
peer=peer,
|
|
283
|
+
user_agent=user_agent,
|
|
284
|
+
context=context,
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
try:
|
|
288
|
+
# Count requests (async for)
|
|
289
|
+
requests = []
|
|
290
|
+
request_count = 0
|
|
291
|
+
async for req in request_iterator:
|
|
292
|
+
request_count += 1
|
|
293
|
+
requests.append(req)
|
|
294
|
+
|
|
295
|
+
# Process and count responses (async for)
|
|
296
|
+
async def async_iter():
|
|
297
|
+
for r in requests:
|
|
298
|
+
yield r
|
|
299
|
+
|
|
300
|
+
response_count = 0
|
|
301
|
+
async for response in behavior(async_iter(), context):
|
|
302
|
+
response_count += 1
|
|
303
|
+
yield response
|
|
304
|
+
|
|
305
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
306
|
+
|
|
307
|
+
# Mark as successful (async)
|
|
308
|
+
await self._mark_success_async(
|
|
309
|
+
log_entry,
|
|
310
|
+
duration_ms=duration_ms,
|
|
311
|
+
response_data={"request_count": request_count, "response_count": response_count} if not self.log_response_data else None,
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
except Exception as e:
|
|
315
|
+
duration_ms = int((time.time() - start_time) * 1000)
|
|
316
|
+
|
|
317
|
+
# Mark as error (async)
|
|
318
|
+
await self._mark_error_async(
|
|
319
|
+
log_entry,
|
|
320
|
+
error=e,
|
|
321
|
+
context=context,
|
|
322
|
+
duration_ms=duration_ms,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
raise
|
|
326
|
+
|
|
327
|
+
return wrapper
|
|
328
|
+
|
|
329
|
+
# Return wrapped handler based on type
|
|
330
|
+
if handler.unary_unary:
|
|
331
|
+
return grpc.unary_unary_rpc_method_handler(
|
|
332
|
+
wrap_unary_unary(handler.unary_unary),
|
|
333
|
+
request_deserializer=handler.request_deserializer,
|
|
334
|
+
response_serializer=handler.response_serializer,
|
|
335
|
+
)
|
|
336
|
+
elif handler.unary_stream:
|
|
337
|
+
return grpc.unary_stream_rpc_method_handler(
|
|
338
|
+
wrap_unary_stream(handler.unary_stream),
|
|
339
|
+
request_deserializer=handler.request_deserializer,
|
|
340
|
+
response_serializer=handler.response_serializer,
|
|
341
|
+
)
|
|
342
|
+
elif handler.stream_unary:
|
|
343
|
+
return grpc.stream_unary_rpc_method_handler(
|
|
344
|
+
wrap_stream_unary(handler.stream_unary),
|
|
345
|
+
request_deserializer=handler.request_deserializer,
|
|
346
|
+
response_serializer=handler.response_serializer,
|
|
347
|
+
)
|
|
348
|
+
elif handler.stream_stream:
|
|
349
|
+
return grpc.stream_stream_rpc_method_handler(
|
|
350
|
+
wrap_stream_stream(handler.stream_stream),
|
|
351
|
+
request_deserializer=handler.request_deserializer,
|
|
352
|
+
response_serializer=handler.response_serializer,
|
|
353
|
+
)
|
|
354
|
+
else:
|
|
355
|
+
return handler
|
|
356
|
+
|
|
357
|
+
async def _create_log_entry_async(
|
|
358
|
+
self,
|
|
359
|
+
request_id: str,
|
|
360
|
+
service_name: str,
|
|
361
|
+
method_name: str,
|
|
362
|
+
full_method: str,
|
|
363
|
+
peer: str,
|
|
364
|
+
user_agent: str,
|
|
365
|
+
context: grpc.aio.ServicerContext,
|
|
366
|
+
request=None,
|
|
367
|
+
):
|
|
368
|
+
"""Create initial log entry in database (async)."""
|
|
369
|
+
try:
|
|
370
|
+
from ..models import GRPCRequestLog
|
|
371
|
+
from ..auth import get_current_grpc_user, get_current_grpc_api_key
|
|
372
|
+
|
|
373
|
+
# Get user and api_key from contextvars (set by ApiKeyAuthInterceptor)
|
|
374
|
+
user = get_current_grpc_user()
|
|
375
|
+
api_key = get_current_grpc_api_key()
|
|
376
|
+
is_authenticated = user is not None
|
|
377
|
+
|
|
378
|
+
logger.info(f"[RequestLogger] Got contextvar api_key = {api_key} (user={user}, authenticated={is_authenticated})")
|
|
379
|
+
|
|
380
|
+
# Extract client IP from peer
|
|
381
|
+
client_ip = self._extract_ip_from_peer(peer)
|
|
382
|
+
|
|
383
|
+
# Create log entry (wrap Django ORM in asyncio.to_thread)
|
|
384
|
+
log_entry = await asyncio.to_thread(
|
|
385
|
+
GRPCRequestLog.objects.create,
|
|
386
|
+
request_id=request_id,
|
|
387
|
+
service_name=service_name,
|
|
388
|
+
method_name=method_name,
|
|
389
|
+
full_method=full_method,
|
|
390
|
+
user=user if is_authenticated else None,
|
|
391
|
+
api_key=api_key,
|
|
392
|
+
is_authenticated=is_authenticated,
|
|
393
|
+
client_ip=client_ip,
|
|
394
|
+
user_agent=user_agent,
|
|
395
|
+
peer=peer,
|
|
396
|
+
request_data=self._serialize_message(request) if request else None,
|
|
397
|
+
status="pending",
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
return log_entry
|
|
401
|
+
|
|
402
|
+
except Exception as e:
|
|
403
|
+
logger.error(f"Failed to create log entry: {e}", exc_info=True)
|
|
404
|
+
return None
|
|
405
|
+
|
|
406
|
+
async def _mark_success_async(
|
|
407
|
+
self,
|
|
408
|
+
log_entry,
|
|
409
|
+
duration_ms: int,
|
|
410
|
+
response=None,
|
|
411
|
+
request_data: dict = None,
|
|
412
|
+
response_data: dict = None,
|
|
413
|
+
):
|
|
414
|
+
"""Mark log entry as successful (async)."""
|
|
415
|
+
if log_entry is None:
|
|
416
|
+
return
|
|
417
|
+
|
|
418
|
+
try:
|
|
419
|
+
from ..models import GRPCRequestLog
|
|
420
|
+
|
|
421
|
+
# Prepare response data
|
|
422
|
+
if response:
|
|
423
|
+
response_data = self._serialize_message(response)
|
|
424
|
+
|
|
425
|
+
# Wrap Django ORM in asyncio.to_thread
|
|
426
|
+
await asyncio.to_thread(
|
|
427
|
+
GRPCRequestLog.objects.mark_success,
|
|
428
|
+
log_entry,
|
|
429
|
+
duration_ms=duration_ms,
|
|
430
|
+
response_data=response_data,
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
except Exception as e:
|
|
434
|
+
logger.error(f"Failed to mark success: {e}", exc_info=True)
|
|
435
|
+
|
|
436
|
+
async def _mark_error_async(
|
|
437
|
+
self,
|
|
438
|
+
log_entry,
|
|
439
|
+
error: Exception,
|
|
440
|
+
context: grpc.aio.ServicerContext,
|
|
441
|
+
duration_ms: int,
|
|
442
|
+
):
|
|
443
|
+
"""Mark log entry as error (async)."""
|
|
444
|
+
if log_entry is None:
|
|
445
|
+
return
|
|
446
|
+
|
|
447
|
+
try:
|
|
448
|
+
from ..models import GRPCRequestLog
|
|
449
|
+
|
|
450
|
+
# Get gRPC status code
|
|
451
|
+
grpc_code = self._get_grpc_code(error, context)
|
|
452
|
+
|
|
453
|
+
# Wrap Django ORM in asyncio.to_thread
|
|
454
|
+
await asyncio.to_thread(
|
|
455
|
+
GRPCRequestLog.objects.mark_error,
|
|
456
|
+
log_entry,
|
|
457
|
+
grpc_status_code=grpc_code,
|
|
458
|
+
error_message=str(error),
|
|
459
|
+
error_details={"type": type(error).__name__},
|
|
460
|
+
duration_ms=duration_ms,
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
except Exception as e:
|
|
464
|
+
logger.error(f"Failed to mark error: {e}", exc_info=True)
|
|
465
|
+
|
|
466
|
+
def _parse_method(self, full_method: str) -> tuple[str, str]:
|
|
467
|
+
"""
|
|
468
|
+
Parse full method path into service and method names.
|
|
469
|
+
|
|
470
|
+
Args:
|
|
471
|
+
full_method: Full method path (e.g., /myapp.UserService/GetUser)
|
|
472
|
+
|
|
473
|
+
Returns:
|
|
474
|
+
(service_name, method_name) tuple
|
|
475
|
+
"""
|
|
476
|
+
try:
|
|
477
|
+
parts = full_method.strip("/").split("/")
|
|
478
|
+
if len(parts) >= 2:
|
|
479
|
+
return parts[0], parts[1]
|
|
480
|
+
else:
|
|
481
|
+
return full_method, "unknown"
|
|
482
|
+
except Exception:
|
|
483
|
+
return full_method, "unknown"
|
|
484
|
+
|
|
485
|
+
def _extract_ip_from_peer(self, peer: str) -> str | None:
|
|
486
|
+
"""
|
|
487
|
+
Extract IP address from peer string.
|
|
488
|
+
|
|
489
|
+
Args:
|
|
490
|
+
peer: Peer string (e.g., ipv4:127.0.0.1:12345)
|
|
491
|
+
|
|
492
|
+
Returns:
|
|
493
|
+
IP address or None
|
|
494
|
+
"""
|
|
495
|
+
try:
|
|
496
|
+
if ":" in peer:
|
|
497
|
+
parts = peer.split(":")
|
|
498
|
+
# Handle ipv4:x.x.x.x:port format
|
|
499
|
+
if len(parts) >= 3 and parts[0] in ["ipv4", "ipv6"]:
|
|
500
|
+
return parts[1]
|
|
501
|
+
# Handle x.x.x.x:port format
|
|
502
|
+
elif len(parts) == 2:
|
|
503
|
+
return parts[0]
|
|
504
|
+
except Exception:
|
|
505
|
+
pass
|
|
506
|
+
return None
|
|
507
|
+
|
|
508
|
+
def _get_grpc_code(self, error: Exception, context: grpc.aio.ServicerContext) -> str:
|
|
509
|
+
"""Get gRPC status code from error."""
|
|
510
|
+
try:
|
|
511
|
+
# Check if error is a gRPC error
|
|
512
|
+
if hasattr(error, "code"):
|
|
513
|
+
return error.code().name
|
|
514
|
+
|
|
515
|
+
# Try to get from context
|
|
516
|
+
if hasattr(context, "_state") and hasattr(context._state, "code"):
|
|
517
|
+
return context._state.code.name
|
|
518
|
+
|
|
519
|
+
# Default to UNKNOWN
|
|
520
|
+
return "UNKNOWN"
|
|
521
|
+
except Exception:
|
|
522
|
+
return "UNKNOWN"
|
|
523
|
+
|
|
524
|
+
def _serialize_message(self, message) -> dict | None:
|
|
525
|
+
"""Serialize protobuf message to dict."""
|
|
526
|
+
try:
|
|
527
|
+
# Try to use MessageToDict from google.protobuf
|
|
528
|
+
from google.protobuf.json_format import MessageToDict
|
|
529
|
+
return MessageToDict(message)
|
|
530
|
+
except Exception as e:
|
|
531
|
+
logger.debug(f"Failed to serialize message: {e}")
|
|
532
|
+
return None
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
__all__ = ["RequestLoggerInterceptor"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Management commands for gRPC app."""
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Management command to generate .proto files from Django models.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python manage.py generate_protos [app_label ...]
|
|
6
|
+
python manage.py generate_protos crypto
|
|
7
|
+
python manage.py generate_protos crypto accounts
|
|
8
|
+
python manage.py generate_protos --all
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from django.core.management.base import CommandError
|
|
12
|
+
from django.apps import apps
|
|
13
|
+
|
|
14
|
+
from django_cfg.management.utils import AdminCommand
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Command(AdminCommand):
|
|
18
|
+
command_name = 'generate_protos'
|
|
19
|
+
help = "Generate .proto files from Django models"
|
|
20
|
+
|
|
21
|
+
def add_arguments(self, parser):
|
|
22
|
+
parser.add_argument(
|
|
23
|
+
"apps",
|
|
24
|
+
nargs="*",
|
|
25
|
+
type=str,
|
|
26
|
+
help="App labels to generate protos for",
|
|
27
|
+
)
|
|
28
|
+
parser.add_argument(
|
|
29
|
+
"--all",
|
|
30
|
+
action="store_true",
|
|
31
|
+
help="Generate protos for all enabled apps from GRPC config",
|
|
32
|
+
)
|
|
33
|
+
parser.add_argument(
|
|
34
|
+
"--output-dir",
|
|
35
|
+
type=str,
|
|
36
|
+
default=None,
|
|
37
|
+
help="Custom output directory (overrides config)",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def handle(self, *args, **options):
|
|
41
|
+
from django_cfg.apps.integrations.grpc.utils.proto_gen import generate_proto_for_app
|
|
42
|
+
from django_cfg.apps.integrations.grpc.services.config_helper import get_grpc_config
|
|
43
|
+
|
|
44
|
+
# Get gRPC config
|
|
45
|
+
grpc_config = get_grpc_config()
|
|
46
|
+
if not grpc_config or not grpc_config.enabled:
|
|
47
|
+
raise CommandError("gRPC is not enabled in configuration")
|
|
48
|
+
|
|
49
|
+
# Determine which apps to generate
|
|
50
|
+
app_labels = options["apps"]
|
|
51
|
+
|
|
52
|
+
if options["all"]:
|
|
53
|
+
# Use enabled_apps from config
|
|
54
|
+
app_labels = grpc_config.enabled_apps
|
|
55
|
+
if not app_labels:
|
|
56
|
+
raise CommandError("No enabled_apps configured in GRPCConfig")
|
|
57
|
+
self.stdout.write(
|
|
58
|
+
self.style.SUCCESS(
|
|
59
|
+
f"Generating protos for all enabled apps: {', '.join(app_labels)}"
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
elif not app_labels:
|
|
63
|
+
# No apps specified - show help
|
|
64
|
+
raise CommandError(
|
|
65
|
+
"Please specify app labels or use --all flag\n"
|
|
66
|
+
"Examples:\n"
|
|
67
|
+
" python manage.py generate_protos crypto\n"
|
|
68
|
+
" python manage.py generate_protos crypto accounts\n"
|
|
69
|
+
" python manage.py generate_protos --all"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Validate apps exist
|
|
73
|
+
for app_label in app_labels:
|
|
74
|
+
try:
|
|
75
|
+
apps.get_app_config(app_label)
|
|
76
|
+
except LookupError:
|
|
77
|
+
raise CommandError(f"App '{app_label}' not found")
|
|
78
|
+
|
|
79
|
+
# Get output directory from options or config
|
|
80
|
+
output_dir = None
|
|
81
|
+
if options["output_dir"]:
|
|
82
|
+
from pathlib import Path
|
|
83
|
+
output_dir = Path(options["output_dir"])
|
|
84
|
+
self.stdout.write(
|
|
85
|
+
self.style.WARNING(f"Using custom output directory: {output_dir}")
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# Generate protos
|
|
89
|
+
total_generated = 0
|
|
90
|
+
for app_label in app_labels:
|
|
91
|
+
self.stdout.write(f"\n📦 Generating proto for app: {app_label}")
|
|
92
|
+
|
|
93
|
+
try:
|
|
94
|
+
count = generate_proto_for_app(app_label, output_dir=output_dir)
|
|
95
|
+
if count > 0:
|
|
96
|
+
total_generated += count
|
|
97
|
+
self.stdout.write(
|
|
98
|
+
self.style.SUCCESS(f" ✅ Generated {app_label}.proto")
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
self.stdout.write(
|
|
102
|
+
self.style.WARNING(f" ⚠️ No models found in {app_label}")
|
|
103
|
+
)
|
|
104
|
+
except Exception as e:
|
|
105
|
+
self.stdout.write(
|
|
106
|
+
self.style.ERROR(f" ❌ Failed: {e}")
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# Summary
|
|
110
|
+
self.stdout.write("\n" + "=" * 70)
|
|
111
|
+
if total_generated > 0:
|
|
112
|
+
# Show output location
|
|
113
|
+
if output_dir:
|
|
114
|
+
output_location = output_dir
|
|
115
|
+
elif grpc_config.proto and grpc_config.proto.output_dir:
|
|
116
|
+
output_location = grpc_config.proto.output_dir
|
|
117
|
+
else:
|
|
118
|
+
output_location = "media/protos"
|
|
119
|
+
|
|
120
|
+
self.stdout.write(
|
|
121
|
+
self.style.SUCCESS(
|
|
122
|
+
f"🎉 Generated {total_generated} proto file(s)\n"
|
|
123
|
+
f"📂 Output directory: {output_location}"
|
|
124
|
+
)
|
|
125
|
+
)
|
|
126
|
+
else:
|
|
127
|
+
self.stdout.write(
|
|
128
|
+
self.style.WARNING("⚠️ No proto files generated")
|
|
129
|
+
)
|
|
130
|
+
self.stdout.write("=" * 70)
|