django-cfg 1.3.13__py3-none-any.whl → 1.4.0__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.
- django_cfg/__init__.py +1 -1
- django_cfg/apps/accounts/admin/user_admin.py +39 -16
- django_cfg/apps/accounts/serializers/profile.py +1 -1
- django_cfg/apps/accounts/services/otp_service.py +18 -11
- django_cfg/apps/accounts/signals.py +15 -24
- django_cfg/apps/accounts/utils/notifications.py +217 -358
- django_cfg/apps/accounts/views/otp.py +2 -2
- django_cfg/apps/accounts/views/webhook.py +1 -1
- django_cfg/apps/agents/core/django_agent.py +1 -1
- django_cfg/apps/api/commands/views.py +66 -83
- django_cfg/apps/api/health/drf_views.py +269 -0
- django_cfg/apps/api/health/serializers.py +45 -0
- django_cfg/apps/api/health/urls.py +6 -1
- django_cfg/apps/knowbase/admin/actions/__init__.py +13 -0
- django_cfg/apps/knowbase/admin/actions/visibility_actions.py +56 -0
- django_cfg/apps/knowbase/admin/document_admin.py +136 -270
- django_cfg/apps/knowbase/admin/helpers/__init__.py +17 -0
- django_cfg/apps/knowbase/admin/helpers/configs.py +72 -0
- django_cfg/apps/knowbase/admin/helpers/display_helpers.py +156 -0
- django_cfg/apps/knowbase/admin/helpers/statistics.py +108 -0
- django_cfg/apps/knowbase/config/constance_fields.py +1 -1
- django_cfg/apps/knowbase/config/settings.py +2 -2
- django_cfg/apps/knowbase/mixins/__init__.py +19 -2
- django_cfg/apps/knowbase/mixins/config/__init__.py +14 -0
- django_cfg/apps/knowbase/mixins/config/defaults.py +75 -0
- django_cfg/apps/knowbase/mixins/config/meta_config.py +120 -0
- django_cfg/apps/knowbase/mixins/creator.py +10 -10
- django_cfg/apps/knowbase/mixins/external_data_mixin.py +105 -403
- django_cfg/apps/knowbase/mixins/generators/__init__.py +16 -0
- django_cfg/apps/knowbase/mixins/generators/content_generator.py +218 -0
- django_cfg/apps/knowbase/mixins/generators/field_analyzer.py +76 -0
- django_cfg/apps/knowbase/mixins/generators/metadata_generator.py +124 -0
- django_cfg/apps/knowbase/mixins/service.py +2 -2
- django_cfg/apps/knowbase/services/archive/__init__.py +1 -0
- django_cfg/apps/knowbase/services/archive/analyzers/__init__.py +17 -0
- django_cfg/apps/knowbase/services/archive/analyzers/complexity_analyzer.py +33 -0
- django_cfg/apps/knowbase/services/archive/analyzers/purpose_detector.py +36 -0
- django_cfg/apps/knowbase/services/archive/analyzers/quality_analyzer.py +39 -0
- django_cfg/apps/knowbase/services/archive/analyzers/tag_generator.py +103 -0
- django_cfg/apps/knowbase/services/archive/chunking/__init__.py +19 -0
- django_cfg/apps/knowbase/services/archive/chunking/base.py +81 -0
- django_cfg/apps/knowbase/services/archive/chunking/json_chunker.py +62 -0
- django_cfg/apps/knowbase/services/archive/chunking/markdown_chunker.py +107 -0
- django_cfg/apps/knowbase/services/archive/chunking/python_chunker.py +248 -0
- django_cfg/apps/knowbase/services/archive/chunking/text_chunker.py +70 -0
- django_cfg/apps/knowbase/services/archive/chunking_service.py +110 -729
- django_cfg/apps/knowbase/services/archive/context/__init__.py +14 -0
- django_cfg/apps/knowbase/services/archive/context/builders.py +220 -0
- django_cfg/apps/knowbase/services/archive/context/models.py +38 -0
- django_cfg/apps/knowbase/services/embedding/models.py +18 -14
- django_cfg/apps/knowbase/services/embedding/processors.py +6 -3
- django_cfg/apps/knowbase/tasks/document_processing.py +11 -3
- django_cfg/apps/leads/tests.py +1 -1
- django_cfg/apps/payments/admin/api_keys_admin.py +1 -1
- django_cfg/apps/payments/admin/balance_admin.py +1 -1
- django_cfg/apps/payments/admin/currencies_admin.py +1 -1
- django_cfg/apps/payments/admin/payments_admin.py +1 -1
- django_cfg/apps/payments/admin/subscriptions_admin.py +1 -1
- django_cfg/apps/payments/admin_interface/templates/payments/base.html +59 -126
- django_cfg/apps/payments/admin_interface/views/api/payments.py +1 -1
- django_cfg/apps/payments/admin_interface/views/api/stats.py +1 -1
- django_cfg/apps/payments/admin_interface/views/api/users.py +1 -1
- django_cfg/apps/payments/admin_interface/views/api/webhook_admin.py +1 -1
- django_cfg/apps/payments/admin_interface/views/api/webhook_public.py +1 -1
- django_cfg/apps/payments/admin_interface/views/base.py +29 -2
- django_cfg/apps/payments/apps.py +1 -1
- django_cfg/apps/payments/config/django_cfg_integration.py +2 -2
- django_cfg/apps/payments/config/helpers.py +3 -2
- django_cfg/apps/payments/management/commands/cleanup_expired_data.py +1 -1
- django_cfg/apps/payments/management/commands/currency_stats.py +1 -1
- django_cfg/apps/payments/management/commands/manage_currencies.py +1 -1
- django_cfg/apps/payments/management/commands/manage_providers.py +1 -1
- django_cfg/apps/payments/management/commands/process_pending_payments.py +1 -1
- django_cfg/apps/payments/management/commands/test_providers.py +1 -1
- django_cfg/apps/payments/middleware/api_access.py +1 -1
- django_cfg/apps/payments/middleware/rate_limiting.py +1 -1
- django_cfg/apps/payments/middleware/usage_tracking.py +1 -1
- django_cfg/apps/payments/models/balance.py +2 -2
- django_cfg/apps/payments/models/managers/api_key_managers.py +1 -1
- django_cfg/apps/payments/models/managers/balance_managers.py +1 -1
- django_cfg/apps/payments/models/managers/currency_managers.py +1 -1
- django_cfg/apps/payments/models/managers/payment_managers.py +1 -1
- django_cfg/apps/payments/models/managers/subscription_managers.py +1 -1
- django_cfg/apps/payments/models/payments.py +2 -2
- django_cfg/apps/payments/services/cache_service/__init__.py +1 -1
- django_cfg/apps/payments/services/cache_service/simple_cache.py +10 -5
- django_cfg/apps/payments/services/core/base.py +1 -1
- django_cfg/apps/payments/services/core/currency/__init__.py +13 -0
- django_cfg/apps/payments/services/core/currency/currency_converter.py +57 -0
- django_cfg/apps/payments/services/core/currency/currency_validator.py +61 -0
- django_cfg/apps/payments/services/core/operations/__init__.py +15 -0
- django_cfg/apps/payments/services/core/operations/payment_canceller.py +100 -0
- django_cfg/apps/payments/services/core/operations/payment_creator.py +196 -0
- django_cfg/apps/payments/services/core/operations/status_checker.py +100 -0
- django_cfg/apps/payments/services/core/payment_service.py +124 -612
- django_cfg/apps/payments/services/core/providers/__init__.py +13 -0
- django_cfg/apps/payments/services/core/providers/provider_client.py +132 -0
- django_cfg/apps/payments/services/core/providers/status_mapper.py +89 -0
- django_cfg/apps/payments/services/core/utils/__init__.py +13 -0
- django_cfg/apps/payments/services/core/utils/data_converter.py +48 -0
- django_cfg/apps/payments/services/core/utils/statistics_calculator.py +69 -0
- django_cfg/apps/payments/services/providers/base.py +1 -1
- django_cfg/apps/payments/services/providers/nowpayments/__init__.py +3 -3
- django_cfg/apps/payments/services/providers/nowpayments/parsers/__init__.py +9 -0
- django_cfg/apps/payments/services/providers/nowpayments/parsers/data/__init__.py +23 -0
- django_cfg/apps/payments/services/providers/nowpayments/parsers/data/constants.py +23 -0
- django_cfg/apps/payments/services/providers/nowpayments/parsers/data/currency_names.py +244 -0
- django_cfg/apps/payments/services/providers/nowpayments/parsers/data/patterns.py +511 -0
- django_cfg/apps/payments/services/providers/nowpayments/parsers/parser.py +168 -0
- django_cfg/apps/payments/services/providers/nowpayments/provider.py +1 -1
- django_cfg/apps/payments/services/providers/nowpayments/sync.py +1 -1
- django_cfg/apps/payments/services/providers/registry.py +1 -1
- django_cfg/apps/payments/services/providers/sync_service.py +1 -1
- django_cfg/apps/payments/signals/__init__.py +1 -1
- django_cfg/apps/payments/signals/api_key_signals.py +1 -1
- django_cfg/apps/payments/signals/balance_signals.py +1 -1
- django_cfg/apps/payments/signals/payment_signals.py +1 -1
- django_cfg/apps/payments/signals/subscription_signals.py +1 -1
- django_cfg/apps/payments/views/api/api_keys.py +1 -1
- django_cfg/apps/payments/views/api/balances.py +1 -1
- django_cfg/apps/payments/views/api/base.py +1 -1
- django_cfg/apps/payments/views/api/currencies.py +1 -1
- django_cfg/apps/payments/views/api/payments.py +1 -1
- django_cfg/apps/payments/views/api/subscriptions.py +1 -1
- django_cfg/apps/payments/views/api/webhooks.py +1 -1
- django_cfg/apps/payments/views/serializers/api_keys.py +1 -1
- django_cfg/apps/payments/views/serializers/balances.py +1 -1
- django_cfg/apps/payments/views/serializers/currencies.py +1 -1
- django_cfg/apps/payments/views/serializers/payments.py +1 -1
- django_cfg/apps/payments/views/serializers/subscriptions.py +1 -1
- django_cfg/apps/payments/views/serializers/webhooks.py +1 -1
- django_cfg/apps/support/admin/support_admin.py +21 -13
- django_cfg/apps/support/templates/support/chat/access_denied.html +21 -27
- django_cfg/apps/support/templates/support/chat/ticket_chat.html +183 -254
- django_cfg/apps/support/utils/support_email_service.py +1 -1
- django_cfg/apps/tasks/templates/tasks/layout/base.html +20 -115
- django_cfg/apps/tasks/utils/simulator.py +1 -1
- django_cfg/apps/tasks/views/dashboard.py +33 -3
- django_cfg/apps/urls.py +5 -1
- django_cfg/cli/README.md +57 -471
- django_cfg/cli/commands/create_project.py +140 -529
- django_cfg/cli/main.py +13 -10
- django_cfg/core/__init__.py +63 -6
- django_cfg/core/base/__init__.py +5 -0
- django_cfg/core/base/config_model.py +652 -0
- django_cfg/core/builders/__init__.py +11 -0
- django_cfg/core/builders/apps_builder.py +258 -0
- django_cfg/core/builders/middleware_builder.py +115 -0
- django_cfg/core/builders/security_builder.py +96 -0
- django_cfg/core/config.py +20 -892
- django_cfg/core/constants.py +69 -0
- django_cfg/core/environment/__init__.py +9 -0
- django_cfg/core/exceptions.py +45 -298
- django_cfg/core/generation/__init__.py +51 -0
- django_cfg/core/generation/core_generators/__init__.py +0 -0
- django_cfg/core/generation/core_generators/settings.py +90 -0
- django_cfg/core/generation/core_generators/static.py +82 -0
- django_cfg/core/generation/core_generators/templates.py +141 -0
- django_cfg/core/generation/data_generators/__init__.py +15 -0
- django_cfg/core/generation/data_generators/cache.py +132 -0
- django_cfg/core/generation/data_generators/database.py +117 -0
- django_cfg/core/generation/generation.py +92 -0
- django_cfg/core/generation/integration_generators/__init__.py +21 -0
- django_cfg/core/generation/integration_generators/api.py +237 -0
- django_cfg/core/generation/integration_generators/sessions.py +65 -0
- django_cfg/core/generation/integration_generators/tailwind.py +54 -0
- django_cfg/core/generation/integration_generators/tasks.py +92 -0
- django_cfg/core/generation/integration_generators/third_party.py +144 -0
- django_cfg/core/generation/orchestrator.py +285 -0
- django_cfg/core/generation/protocols.py +30 -0
- django_cfg/core/generation/security_generators/__init__.py +0 -0
- django_cfg/core/generation/utility_generators/__init__.py +24 -0
- django_cfg/core/generation/utility_generators/email.py +58 -0
- django_cfg/core/generation/utility_generators/i18n.py +66 -0
- django_cfg/core/generation/utility_generators/limits.py +58 -0
- django_cfg/core/generation/utility_generators/logging.py +66 -0
- django_cfg/core/generation/utility_generators/security.py +101 -0
- django_cfg/core/generation/utils/__init__.py +0 -0
- django_cfg/core/generation/utils/helpers.py +32 -0
- django_cfg/core/integration/__init__.py +18 -25
- django_cfg/core/integration/display/startup.py +146 -133
- django_cfg/core/integration/url_integration.py +13 -2
- django_cfg/core/services/__init__.py +5 -0
- django_cfg/core/services/config_service.py +121 -0
- django_cfg/core/state/__init__.py +9 -0
- django_cfg/core/state/registry.py +84 -0
- django_cfg/core/types/__init__.py +15 -0
- django_cfg/core/types/aliases.py +15 -0
- django_cfg/core/types/enums.py +49 -0
- django_cfg/dashboard/DEBUG_README.md +105 -0
- django_cfg/dashboard/REFACTORING_SUMMARY.md +237 -0
- django_cfg/dashboard/__init__.py +24 -0
- django_cfg/dashboard/components.py +308 -0
- django_cfg/dashboard/debug.py +176 -0
- django_cfg/dashboard/management/__init__.py +0 -0
- django_cfg/dashboard/management/commands/__init__.py +0 -0
- django_cfg/dashboard/management/commands/debug_dashboard.py +109 -0
- django_cfg/dashboard/sections/__init__.py +1 -0
- django_cfg/dashboard/sections/base.py +128 -0
- django_cfg/dashboard/sections/commands.py +32 -0
- django_cfg/dashboard/sections/overview.py +394 -0
- django_cfg/dashboard/sections/stats.py +48 -0
- django_cfg/dashboard/sections/system.py +73 -0
- django_cfg/management/commands/check_settings.py +6 -2
- django_cfg/management/commands/clear_constance.py +6 -1
- django_cfg/management/commands/create_token.py +5 -4
- django_cfg/management/commands/generate.py +5 -0
- django_cfg/management/commands/list_urls.py +7 -2
- django_cfg/management/commands/migrate_all.py +6 -2
- django_cfg/management/commands/migrator.py +6 -1
- django_cfg/management/commands/rundramatiq.py +6 -1
- django_cfg/management/commands/rundramatiq_simulator.py +11 -4
- django_cfg/management/commands/runserver_ngrok.py +9 -7
- django_cfg/management/commands/script.py +25 -21
- django_cfg/management/commands/show_config.py +6 -1
- django_cfg/management/commands/show_urls.py +8 -3
- django_cfg/management/commands/superuser.py +5 -4
- django_cfg/management/commands/task_clear.py +8 -3
- django_cfg/management/commands/task_status.py +8 -3
- django_cfg/management/commands/test_email.py +6 -1
- django_cfg/management/commands/test_telegram.py +6 -1
- django_cfg/management/commands/test_twilio.py +6 -1
- django_cfg/management/commands/tree.py +7 -4
- django_cfg/models/__init__.py +88 -3
- django_cfg/models/api/__init__.py +27 -0
- django_cfg/models/{api.py → api/config.py} +1 -1
- django_cfg/models/api/drf/__init__.py +21 -0
- django_cfg/models/api/drf/config.py +101 -0
- django_cfg/models/api/drf/redoc.py +31 -0
- django_cfg/models/api/drf/spectacular.py +129 -0
- django_cfg/models/api/drf/swagger.py +59 -0
- django_cfg/models/{api_keys.py → api/keys.py} +16 -6
- django_cfg/models/{limits.py → api/limits.py} +0 -1
- django_cfg/models/base/__init__.py +14 -0
- django_cfg/models/django/__init__.py +16 -0
- django_cfg/models/{constance.py → django/constance.py} +1 -1
- django_cfg/models/{environment.py → django/environment.py} +1 -1
- django_cfg/models/infrastructure/__init__.py +17 -0
- django_cfg/models/{cache.py → infrastructure/cache.py} +3 -2
- django_cfg/models/infrastructure/database/__init__.py +22 -0
- django_cfg/models/infrastructure/database/config.py +265 -0
- django_cfg/models/infrastructure/database/converters.py +91 -0
- django_cfg/models/infrastructure/database/parsers.py +96 -0
- django_cfg/models/infrastructure/database/routing.py +85 -0
- django_cfg/models/infrastructure/database/validators.py +170 -0
- django_cfg/models/{logging.py → infrastructure/logging.py} +1 -1
- django_cfg/models/{security.py → infrastructure/security.py} +2 -2
- django_cfg/models/ngrok/__init__.py +11 -0
- django_cfg/models/ngrok/auth.py +37 -0
- django_cfg/models/ngrok/config.py +77 -0
- django_cfg/models/ngrok/tunnel.py +35 -0
- django_cfg/models/payments/__init__.py +20 -0
- django_cfg/models/payments/api_keys.py +57 -0
- django_cfg/models/{payments.py → payments/config.py} +56 -154
- django_cfg/models/payments/providers/__init__.py +15 -0
- django_cfg/models/payments/providers/base.py +25 -0
- django_cfg/models/payments/providers/nowpayments.py +48 -0
- django_cfg/models/services/__init__.py +18 -0
- django_cfg/models/services/base.py +65 -0
- django_cfg/models/{email.py → services/email.py} +1 -1
- django_cfg/models/services/telegram.py +172 -0
- django_cfg/models/tasks/__init__.py +51 -0
- django_cfg/models/tasks/backends.py +250 -0
- django_cfg/models/tasks/config.py +314 -0
- django_cfg/models/tasks/utils.py +174 -0
- django_cfg/modules/base.py +18 -3
- django_cfg/modules/django_admin/decorators/actions.py +1 -1
- django_cfg/modules/django_admin/decorators/display.py +1 -1
- django_cfg/modules/django_admin/mixins/standalone_actions_mixin.py +1 -1
- django_cfg/modules/django_cfg_rpc_client/README.md +346 -0
- django_cfg/modules/django_cfg_rpc_client/__init__.py +51 -0
- django_cfg/modules/django_cfg_rpc_client/client.py +540 -0
- django_cfg/modules/django_cfg_rpc_client/config.py +207 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/README.md +517 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/UNFOLD_INTEGRATION.md +439 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/__init__.py +11 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/apps.py +22 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/monitor.py +435 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/static/django_cfg_rpc_dashboard/js/dashboard.js +373 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/templates/django_cfg_rpc_dashboard/base.html +76 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/templates/django_cfg_rpc_dashboard/dashboard.html +200 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/urls.py +22 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/urls_admin.py +9 -0
- django_cfg/modules/django_cfg_rpc_client/dashboard/views.py +251 -0
- django_cfg/modules/django_cfg_rpc_client/exceptions.py +201 -0
- django_cfg/modules/django_drf_theme/CHANGELOG.md +210 -0
- django_cfg/modules/django_drf_theme/EXAMPLE.md +465 -0
- django_cfg/modules/django_drf_theme/IMPLEMENTATION.md +232 -0
- django_cfg/modules/django_drf_theme/README.md +207 -0
- django_cfg/modules/django_drf_theme/TAILWIND_CDN_GUIDE.md +274 -0
- django_cfg/modules/django_drf_theme/__init__.py +23 -0
- django_cfg/modules/django_drf_theme/apps.py +15 -0
- django_cfg/modules/django_drf_theme/renderers.py +58 -0
- django_cfg/modules/django_drf_theme/templates/rest_framework/tailwind/api.html +375 -0
- django_cfg/modules/django_drf_theme/templates/rest_framework/tailwind/base.html +938 -0
- django_cfg/modules/django_drf_theme/templates/rest_framework/tailwind/forms/filter_form.html +132 -0
- django_cfg/modules/django_drf_theme/templates/rest_framework/tailwind/forms/raw_data_form.html +123 -0
- django_cfg/modules/django_drf_theme/templatetags/__init__.py +1 -0
- django_cfg/modules/django_drf_theme/templatetags/tailwind_tags.py +57 -0
- django_cfg/modules/django_email/__init__.py +14 -0
- django_cfg/modules/{django_email.py → django_email/service.py} +78 -113
- django_cfg/modules/django_email/utils.py +40 -0
- django_cfg/modules/django_health/__init__.py +9 -0
- django_cfg/modules/{django_health.py → django_health/service.py} +23 -21
- django_cfg/modules/django_llm/llm/client.py +155 -550
- django_cfg/modules/django_llm/llm/embeddings/__init__.py +13 -0
- django_cfg/modules/django_llm/llm/embeddings/mock_embedder.py +106 -0
- django_cfg/modules/django_llm/llm/embeddings/openai_embedder.py +79 -0
- django_cfg/modules/django_llm/llm/models_api/__init__.py +9 -0
- django_cfg/modules/django_llm/llm/models_api/models_query.py +163 -0
- django_cfg/modules/django_llm/llm/providers/__init__.py +15 -0
- django_cfg/modules/django_llm/llm/providers/config_builder.py +103 -0
- django_cfg/modules/django_llm/llm/providers/provider_manager.py +148 -0
- django_cfg/modules/django_llm/llm/providers/provider_selector.py +60 -0
- django_cfg/modules/django_llm/llm/requests/__init__.py +15 -0
- django_cfg/modules/django_llm/llm/requests/cache_manager.py +170 -0
- django_cfg/modules/django_llm/llm/requests/chat_handler.py +199 -0
- django_cfg/modules/django_llm/llm/requests/embedding_handler.py +113 -0
- django_cfg/modules/django_llm/llm/responses/__init__.py +9 -0
- django_cfg/modules/django_llm/llm/responses/response_builder.py +131 -0
- django_cfg/modules/django_llm/llm/stats/__init__.py +9 -0
- django_cfg/modules/django_llm/llm/stats/stats_manager.py +107 -0
- django_cfg/modules/django_llm/translator/detectors/__init__.py +13 -0
- django_cfg/modules/django_llm/translator/detectors/language_detector.py +90 -0
- django_cfg/modules/django_llm/translator/detectors/script_detector.py +153 -0
- django_cfg/modules/django_llm/translator/stats/__init__.py +11 -0
- django_cfg/modules/django_llm/translator/stats/stats_tracker.py +85 -0
- django_cfg/modules/django_llm/translator/translator.py +150 -603
- django_cfg/modules/django_llm/translator/translators/__init__.py +15 -0
- django_cfg/modules/django_llm/translator/translators/json_translator.py +316 -0
- django_cfg/modules/django_llm/translator/translators/text_translator.py +139 -0
- django_cfg/modules/django_llm/translator/utils/__init__.py +13 -0
- django_cfg/modules/django_llm/translator/utils/prompt_builder.py +110 -0
- django_cfg/modules/django_llm/translator/utils/text_utils.py +114 -0
- django_cfg/modules/django_logging/FIXES_SUMMARY.md +276 -0
- django_cfg/modules/django_logging/LOGGING_GUIDE.md +504 -0
- django_cfg/modules/django_logging/__init__.py +14 -0
- django_cfg/modules/{django_logger.py → django_logging/django_logger.py} +13 -13
- django_cfg/modules/{logger.py → django_logging/logger.py} +14 -4
- django_cfg/modules/django_ngrok/__init__.py +39 -0
- django_cfg/modules/{django_ngrok.py → django_ngrok/service.py} +14 -42
- django_cfg/modules/django_rpc_old/POETRY.md +344 -0
- django_cfg/modules/django_rpc_old/README.md +397 -0
- django_cfg/modules/django_rpc_old/TESTING.md +358 -0
- django_cfg/modules/django_rpc_old/__init__.py +39 -0
- django_cfg/modules/django_rpc_old/client.py +531 -0
- django_cfg/modules/django_rpc_old/config.py +279 -0
- django_cfg/modules/django_rpc_old/exceptions.py +172 -0
- django_cfg/modules/django_tailwind/README.md +478 -0
- django_cfg/modules/django_tailwind/__init__.py +7 -0
- django_cfg/modules/django_tailwind/apps.py +10 -0
- django_cfg/modules/django_tailwind/templates/django_tailwind/app.html +5 -0
- django_cfg/modules/django_tailwind/templates/django_tailwind/base.html +117 -0
- django_cfg/modules/django_tailwind/templates/django_tailwind/components/navbar.html +124 -0
- django_cfg/modules/django_tailwind/templates/django_tailwind/components/theme_toggle.html +54 -0
- django_cfg/modules/django_tailwind/templates/django_tailwind/components/user_menu.html +116 -0
- django_cfg/modules/django_tailwind/templates/django_tailwind/simple.html +46 -0
- django_cfg/modules/django_tailwind/templatetags/__init__.py +1 -0
- django_cfg/modules/django_tailwind/templatetags/tailwind_info.py +185 -0
- django_cfg/modules/django_tasks/__init__.py +29 -0
- django_cfg/modules/django_tasks/factory.py +127 -0
- django_cfg/modules/{django_tasks.py → django_tasks/service.py} +45 -274
- django_cfg/modules/django_tasks/settings.py +107 -0
- django_cfg/modules/django_telegram/__init__.py +29 -0
- django_cfg/modules/{django_telegram.py → django_telegram/service.py} +45 -113
- django_cfg/modules/django_telegram/utils.py +62 -0
- django_cfg/modules/django_twilio/__init__.py +54 -107
- django_cfg/modules/django_twilio/_imports.py +30 -0
- django_cfg/modules/django_twilio/base.py +192 -0
- django_cfg/modules/django_twilio/email_otp.py +227 -0
- django_cfg/modules/django_twilio/sendgrid_service.py +1 -1
- django_cfg/modules/django_twilio/simple_service.py +1 -2
- django_cfg/modules/django_twilio/sms.py +94 -0
- django_cfg/modules/django_twilio/twilio_service.py +2 -3
- django_cfg/modules/django_twilio/unified.py +310 -0
- django_cfg/modules/django_twilio/utils.py +190 -0
- django_cfg/modules/django_twilio/whatsapp.py +137 -0
- django_cfg/modules/django_unfold/callbacks/base.py +198 -7
- django_cfg/modules/django_unfold/callbacks/main.py +102 -10
- django_cfg/modules/django_unfold/dashboard.py +65 -43
- django_cfg/modules/django_unfold/models/config.py +13 -12
- django_cfg/modules/django_unfold/models/navigation.py +8 -3
- django_cfg/modules/django_unfold/models/tabs.py +2 -2
- django_cfg/modules/django_unfold/templates/unfold/helpers/app_list.html +102 -0
- django_cfg/registry/core.py +24 -26
- django_cfg/registry/modules.py +5 -2
- django_cfg/registry/services.py +20 -3
- django_cfg/registry/third_party.py +8 -8
- django_cfg/static/admin/css/dashboard.css +260 -0
- django_cfg/static/admin/js/commands.js +171 -0
- django_cfg/static/admin/js/dashboard.js +126 -0
- django_cfg/templates/admin/components/management_commands.js +375 -0
- django_cfg/templates/admin/components/progress_bar.html +18 -23
- django_cfg/templates/admin/index.html +48 -20
- django_cfg/templates/admin/index_new.html +106 -0
- django_cfg/templates/admin/layouts/base_dashboard.html +60 -0
- django_cfg/templates/admin/layouts/dashboard_with_tabs.html +1 -20
- django_cfg/templates/admin/sections/commands_section.html +626 -0
- django_cfg/templates/admin/sections/overview_section.html +112 -0
- django_cfg/templates/admin/sections/stats_section.html +35 -0
- django_cfg/templates/admin/sections/system_section.html +99 -0
- django_cfg/templates/admin/snippets/components/CHARTS_GUIDE.md +322 -0
- django_cfg/templates/admin/snippets/components/activity_tracker.html +85 -47
- django_cfg/templates/admin/snippets/components/charts_section.html +154 -64
- django_cfg/templates/admin/snippets/components/django_commands.html +3 -3
- django_cfg/templates/admin/snippets/components/recent_activity_improved.html +25 -0
- django_cfg/templates/admin/snippets/components/recent_users_table.html +1 -1
- django_cfg/templates/admin/snippets/components/system_metrics.html +179 -93
- django_cfg/templates/admin/snippets/zones/zones_table.html +2 -2
- django_cfg/templatetags/django_cfg.py +7 -1
- django_cfg/utils/smart_defaults.py +4 -4
- django_cfg-1.4.0.dist-info/METADATA +920 -0
- {django_cfg-1.3.13.dist-info → django_cfg-1.4.0.dist-info}/RECORD +424 -195
- django_cfg/apps/accounts/utils/auth_email_service.py +0 -84
- django_cfg/apps/payments/services/providers/nowpayments/parsers.py +0 -879
- django_cfg/core/generation.py +0 -621
- django_cfg/management/commands/validate_config.py +0 -189
- django_cfg/models/database.py +0 -480
- django_cfg/models/drf.py +0 -272
- django_cfg/models/ngrok.py +0 -122
- django_cfg/models/services.py +0 -440
- django_cfg/models/tasks.py +0 -550
- django_cfg/modules/django_twilio/service.py +0 -942
- django_cfg/template_archive/django_sample.zip +0 -0
- django_cfg/templates/rest_framework/api.html +0 -12
- django_cfg/utils/toolkit.py +0 -703
- django_cfg-1.3.13.dist-info/METADATA +0 -1029
- /django_cfg/apps/accounts/management/commands/{test_otp.py → otp_test.py} +0 -0
- /django_cfg/core/{environment.py → environment/detector.py} +0 -0
- /django_cfg/models/{cors.py → api/cors.py} +0 -0
- /django_cfg/models/{jwt.py → api/jwt.py} +0 -0
- /django_cfg/models/{base.py → base/config.py} +0 -0
- /django_cfg/models/{cfg.py → base/module.py} +0 -0
- /django_cfg/models/{revolution.py → django/revolution.py} +0 -0
- /django_cfg/modules/{dramatiq_setup.py → django_tasks/dramatiq_setup.py} +0 -0
- {django_cfg-1.3.13.dist-info → django_cfg-1.4.0.dist-info}/WHEEL +0 -0
- {django_cfg-1.3.13.dist-info → django_cfg-1.4.0.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.3.13.dist-info → django_cfg-1.4.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
"""Default configurations and constants for django-cfg."""
|
2
|
+
|
3
|
+
from typing import List
|
4
|
+
|
5
|
+
# Default Django apps installed by django-cfg
|
6
|
+
DEFAULT_APPS: List[str] = [
|
7
|
+
# WhiteNoise for static files (must be before django.contrib.staticfiles)
|
8
|
+
"whitenoise.runserver_nostatic",
|
9
|
+
# Unfold Admin
|
10
|
+
"unfold",
|
11
|
+
"unfold.contrib.filters", # optional, if special filters are needed
|
12
|
+
"unfold.contrib.forms", # optional, if special form elements are needed
|
13
|
+
"unfold.contrib.inlines", # optional, if special inlines are needed
|
14
|
+
"import_export", # django-import-export package
|
15
|
+
"unfold.contrib.import_export", # optional, if django-import-export package is used
|
16
|
+
"unfold.contrib.guardian", # optional, if django-guardian package is used
|
17
|
+
"unfold.contrib.simple_history", # optional, if django-simple-history package is used
|
18
|
+
"unfold.contrib.location_field", # optional, if django-location-field package is used
|
19
|
+
"unfold.contrib.constance", # optional, if django-constance package is used
|
20
|
+
# Django Core
|
21
|
+
"django.contrib.admin",
|
22
|
+
"django.contrib.auth",
|
23
|
+
"django.contrib.contenttypes",
|
24
|
+
"django.contrib.sessions",
|
25
|
+
"django.contrib.messages",
|
26
|
+
"django.contrib.staticfiles",
|
27
|
+
"django.contrib.humanize",
|
28
|
+
# Third-party
|
29
|
+
"corsheaders",
|
30
|
+
"rest_framework",
|
31
|
+
"rest_framework.authtoken",
|
32
|
+
"rest_framework_simplejwt",
|
33
|
+
"rest_framework_simplejwt.token_blacklist",
|
34
|
+
"rest_framework_nested",
|
35
|
+
"rangefilter",
|
36
|
+
"django_filters",
|
37
|
+
"drf_spectacular",
|
38
|
+
"drf_spectacular_sidecar",
|
39
|
+
"django_json_widget",
|
40
|
+
"django_extensions",
|
41
|
+
"constance",
|
42
|
+
"constance.backends.database",
|
43
|
+
# Django CFG Core
|
44
|
+
"django_cfg",
|
45
|
+
"django_revolution",
|
46
|
+
]
|
47
|
+
|
48
|
+
# Default middleware stack
|
49
|
+
DEFAULT_MIDDLEWARE: List[str] = [
|
50
|
+
"django.middleware.security.SecurityMiddleware",
|
51
|
+
"whitenoise.middleware.WhiteNoiseMiddleware",
|
52
|
+
"corsheaders.middleware.CorsMiddleware",
|
53
|
+
"django.contrib.sessions.middleware.SessionMiddleware",
|
54
|
+
"django.middleware.common.CommonMiddleware",
|
55
|
+
"django.middleware.csrf.CsrfViewMiddleware",
|
56
|
+
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
57
|
+
"django.contrib.messages.middleware.MessageMiddleware",
|
58
|
+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
59
|
+
]
|
60
|
+
|
61
|
+
# Debug apps (added only in development)
|
62
|
+
DEBUG_APPS: List[str] = [
|
63
|
+
"debug_toolbar",
|
64
|
+
]
|
65
|
+
|
66
|
+
# Debug middleware (added only in development)
|
67
|
+
DEBUG_MIDDLEWARE: List[str] = [
|
68
|
+
"debug_toolbar.middleware.DebugToolbarMiddleware",
|
69
|
+
]
|
django_cfg/core/exceptions.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
"""
|
2
|
-
|
2
|
+
Django-CFG Core Exceptions
|
3
3
|
|
4
|
-
|
5
|
-
No exception suppression, all errors must be properly typed and handled.
|
4
|
+
Custom exception classes for django-cfg with enhanced error context.
|
6
5
|
"""
|
7
6
|
|
8
7
|
from typing import Optional, Dict, Any, List
|
@@ -10,333 +9,81 @@ from typing import Optional, Dict, Any, List
|
|
10
9
|
|
11
10
|
class DjangoCfgException(Exception):
|
12
11
|
"""
|
13
|
-
Base exception for
|
14
|
-
|
15
|
-
|
16
|
-
for specific exception handling patterns.
|
12
|
+
Base exception for django-cfg with enhanced error reporting.
|
13
|
+
|
14
|
+
Supports additional context and actionable suggestions.
|
17
15
|
"""
|
18
|
-
|
16
|
+
|
19
17
|
def __init__(
|
20
|
-
self,
|
21
|
-
message: str,
|
18
|
+
self,
|
19
|
+
message: str,
|
22
20
|
context: Optional[Dict[str, Any]] = None,
|
23
|
-
suggestions: Optional[List[str]] = None
|
24
|
-
|
21
|
+
suggestions: Optional[List[str]] = None,
|
22
|
+
environment: Optional[str] = None,
|
23
|
+
**kwargs
|
24
|
+
):
|
25
25
|
"""
|
26
|
-
Initialize exception with
|
27
|
-
|
26
|
+
Initialize exception with enhanced context.
|
27
|
+
|
28
28
|
Args:
|
29
|
-
message:
|
30
|
-
context: Additional context
|
31
|
-
suggestions: List of
|
29
|
+
message: Primary error message
|
30
|
+
context: Additional context data
|
31
|
+
suggestions: List of actionable suggestions
|
32
|
+
environment: Environment where error occurred
|
33
|
+
**kwargs: Additional metadata
|
32
34
|
"""
|
33
35
|
super().__init__(message)
|
34
36
|
self.message = message
|
35
37
|
self.context = context or {}
|
36
38
|
self.suggestions = suggestions or []
|
37
|
-
|
39
|
+
self.environment = environment
|
40
|
+
self.metadata = kwargs
|
41
|
+
|
38
42
|
def __str__(self) -> str:
|
39
|
-
"""
|
43
|
+
"""Format error message with context."""
|
40
44
|
parts = [self.message]
|
41
|
-
|
42
|
-
if self.context:
|
43
|
-
context_str = ", ".join(f"{k}={v}" for k, v in self.context.items())
|
44
|
-
parts.append(f"Context: {context_str}")
|
45
|
-
|
45
|
+
|
46
46
|
if self.suggestions:
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
parts.append("\nSuggestions:")
|
48
|
+
for suggestion in self.suggestions:
|
49
|
+
parts.append(f" - {suggestion}")
|
50
|
+
|
51
|
+
if self.context:
|
52
|
+
parts.append(f"\nContext: {self.context}")
|
53
|
+
|
54
|
+
return "\n".join(parts)
|
51
55
|
|
52
56
|
|
53
57
|
class ConfigurationError(DjangoCfgException):
|
54
|
-
"""
|
55
|
-
|
56
|
-
|
57
|
-
This exception is raised when:
|
58
|
-
- Required configuration fields are missing
|
59
|
-
- Configuration values are invalid
|
60
|
-
- Configuration conflicts are detected
|
61
|
-
- Environment-specific configuration issues
|
62
|
-
"""
|
63
|
-
|
64
|
-
def __init__(
|
65
|
-
self,
|
66
|
-
message: str,
|
67
|
-
field_name: Optional[str] = None,
|
68
|
-
field_value: Optional[Any] = None,
|
69
|
-
**kwargs
|
70
|
-
) -> None:
|
71
|
-
"""
|
72
|
-
Initialize configuration error.
|
73
|
-
|
74
|
-
Args:
|
75
|
-
message: Error description
|
76
|
-
field_name: Name of the configuration field causing the error
|
77
|
-
field_value: Value that caused the error
|
78
|
-
**kwargs: Additional context passed to base class
|
79
|
-
"""
|
80
|
-
context = kwargs.get('context', {})
|
81
|
-
if field_name is not None:
|
82
|
-
context['field_name'] = field_name
|
83
|
-
if field_value is not None:
|
84
|
-
context['field_value'] = field_value
|
85
|
-
|
86
|
-
kwargs['context'] = context
|
87
|
-
super().__init__(message, **kwargs)
|
88
|
-
|
89
|
-
self.field_name = field_name
|
90
|
-
self.field_value = field_value
|
58
|
+
"""Raised when configuration is invalid or incomplete."""
|
59
|
+
pass
|
91
60
|
|
92
61
|
|
93
62
|
class ValidationError(DjangoCfgException):
|
94
|
-
"""
|
95
|
-
|
96
|
-
|
97
|
-
This exception is raised when:
|
98
|
-
- Pydantic model validation fails
|
99
|
-
- Type validation errors occur
|
100
|
-
- Field constraint violations
|
101
|
-
- Custom validation logic fails
|
102
|
-
"""
|
103
|
-
|
104
|
-
def __init__(
|
105
|
-
self,
|
106
|
-
message: str,
|
107
|
-
model_name: Optional[str] = None,
|
108
|
-
validation_errors: Optional[List[Dict[str, Any]]] = None,
|
109
|
-
**kwargs
|
110
|
-
) -> None:
|
111
|
-
"""
|
112
|
-
Initialize validation error.
|
113
|
-
|
114
|
-
Args:
|
115
|
-
message: Error description
|
116
|
-
model_name: Name of the Pydantic model that failed validation
|
117
|
-
validation_errors: List of Pydantic validation errors
|
118
|
-
**kwargs: Additional context passed to base class
|
119
|
-
"""
|
120
|
-
context = kwargs.get('context', {})
|
121
|
-
if model_name is not None:
|
122
|
-
context['model_name'] = model_name
|
123
|
-
if validation_errors is not None:
|
124
|
-
context['validation_errors'] = validation_errors
|
125
|
-
|
126
|
-
kwargs['context'] = context
|
127
|
-
super().__init__(message, **kwargs)
|
128
|
-
|
129
|
-
self.model_name = model_name
|
130
|
-
self.validation_errors = validation_errors or []
|
63
|
+
"""Raised when validation fails."""
|
64
|
+
pass
|
131
65
|
|
132
66
|
|
133
67
|
class EnvironmentError(DjangoCfgException):
|
134
|
-
"""
|
135
|
-
|
136
|
-
|
137
|
-
This exception is raised when:
|
138
|
-
- Environment cannot be detected
|
139
|
-
- Environment-specific configuration is missing
|
140
|
-
- Environment configuration conflicts
|
141
|
-
- YAML configuration file issues
|
142
|
-
"""
|
143
|
-
|
144
|
-
def __init__(
|
145
|
-
self,
|
146
|
-
message: str,
|
147
|
-
environment: Optional[str] = None,
|
148
|
-
config_file: Optional[str] = None,
|
149
|
-
**kwargs
|
150
|
-
) -> None:
|
151
|
-
"""
|
152
|
-
Initialize environment error.
|
153
|
-
|
154
|
-
Args:
|
155
|
-
message: Error description
|
156
|
-
environment: Environment name that caused the error
|
157
|
-
config_file: Configuration file that caused the error
|
158
|
-
**kwargs: Additional context passed to base class
|
159
|
-
"""
|
160
|
-
context = kwargs.get('context', {})
|
161
|
-
if environment is not None:
|
162
|
-
context['environment'] = environment
|
163
|
-
if config_file is not None:
|
164
|
-
context['config_file'] = config_file
|
165
|
-
|
166
|
-
kwargs['context'] = context
|
167
|
-
super().__init__(message, **kwargs)
|
168
|
-
|
169
|
-
self.environment = environment
|
170
|
-
self.config_file = config_file
|
171
|
-
|
172
|
-
|
173
|
-
class IntegrationError(DjangoCfgException):
|
174
|
-
"""
|
175
|
-
Raised when third-party integration fails.
|
176
|
-
|
177
|
-
This exception is raised when:
|
178
|
-
- Django REST Framework integration issues
|
179
|
-
- Revolution API zone configuration problems
|
180
|
-
- Unfold dashboard configuration errors
|
181
|
-
- Other third-party package integration failures
|
182
|
-
"""
|
183
|
-
|
184
|
-
def __init__(
|
185
|
-
self,
|
186
|
-
message: str,
|
187
|
-
integration_name: Optional[str] = None,
|
188
|
-
package_name: Optional[str] = None,
|
189
|
-
**kwargs
|
190
|
-
) -> None:
|
191
|
-
"""
|
192
|
-
Initialize integration error.
|
193
|
-
|
194
|
-
Args:
|
195
|
-
message: Error description
|
196
|
-
integration_name: Name of the integration that failed
|
197
|
-
package_name: Name of the third-party package
|
198
|
-
**kwargs: Additional context passed to base class
|
199
|
-
"""
|
200
|
-
context = kwargs.get('context', {})
|
201
|
-
if integration_name is not None:
|
202
|
-
context['integration_name'] = integration_name
|
203
|
-
if package_name is not None:
|
204
|
-
context['package_name'] = package_name
|
205
|
-
|
206
|
-
kwargs['context'] = context
|
207
|
-
super().__init__(message, **kwargs)
|
208
|
-
|
209
|
-
self.integration_name = integration_name
|
210
|
-
self.package_name = package_name
|
211
|
-
|
212
|
-
|
213
|
-
class DatabaseError(DjangoCfgException):
|
214
|
-
"""
|
215
|
-
Raised when database configuration or connection issues occur.
|
216
|
-
|
217
|
-
This exception is raised when:
|
218
|
-
- Database connection configuration is invalid
|
219
|
-
- Database routing rules conflict
|
220
|
-
- Database connection testing fails
|
221
|
-
- Multi-database setup issues
|
222
|
-
"""
|
223
|
-
|
224
|
-
def __init__(
|
225
|
-
self,
|
226
|
-
message: str,
|
227
|
-
database_alias: Optional[str] = None,
|
228
|
-
connection_params: Optional[Dict[str, Any]] = None,
|
229
|
-
**kwargs
|
230
|
-
) -> None:
|
231
|
-
"""
|
232
|
-
Initialize database error.
|
233
|
-
|
234
|
-
Args:
|
235
|
-
message: Error description
|
236
|
-
database_alias: Database alias that caused the error
|
237
|
-
connection_params: Database connection parameters
|
238
|
-
**kwargs: Additional context passed to base class
|
239
|
-
"""
|
240
|
-
context = kwargs.get('context', {})
|
241
|
-
if database_alias is not None:
|
242
|
-
context['database_alias'] = database_alias
|
243
|
-
if connection_params is not None:
|
244
|
-
context['connection_params'] = connection_params
|
245
|
-
|
246
|
-
kwargs['context'] = context
|
247
|
-
super().__init__(message, **kwargs)
|
248
|
-
|
249
|
-
self.database_alias = database_alias
|
250
|
-
self.connection_params = connection_params
|
68
|
+
"""Raised when environment-related errors occur."""
|
69
|
+
pass
|
251
70
|
|
252
71
|
|
253
72
|
class CacheError(DjangoCfgException):
|
254
|
-
"""
|
255
|
-
|
256
|
-
|
257
|
-
This exception is raised when:
|
258
|
-
- Cache backend configuration is invalid
|
259
|
-
- Redis connection issues
|
260
|
-
- Cache backend selection problems
|
261
|
-
- Cache key or timeout configuration errors
|
262
|
-
"""
|
263
|
-
|
264
|
-
def __init__(
|
265
|
-
self,
|
266
|
-
message: str,
|
267
|
-
cache_alias: Optional[str] = None,
|
268
|
-
backend_type: Optional[str] = None,
|
269
|
-
**kwargs
|
270
|
-
) -> None:
|
271
|
-
"""
|
272
|
-
Initialize cache error.
|
273
|
-
|
274
|
-
Args:
|
275
|
-
message: Error description
|
276
|
-
cache_alias: Cache alias that caused the error
|
277
|
-
backend_type: Cache backend type (redis, memory, etc.)
|
278
|
-
**kwargs: Additional context passed to base class
|
279
|
-
"""
|
280
|
-
context = kwargs.get('context', {})
|
281
|
-
if cache_alias is not None:
|
282
|
-
context['cache_alias'] = cache_alias
|
283
|
-
if backend_type is not None:
|
284
|
-
context['backend_type'] = backend_type
|
285
|
-
|
286
|
-
kwargs['context'] = context
|
287
|
-
super().__init__(message, **kwargs)
|
288
|
-
|
289
|
-
self.cache_alias = cache_alias
|
290
|
-
self.backend_type = backend_type
|
73
|
+
"""Raised when cache configuration or operations fail."""
|
74
|
+
pass
|
291
75
|
|
292
76
|
|
293
|
-
class
|
294
|
-
"""
|
295
|
-
|
296
|
-
|
297
|
-
This exception is raised when:
|
298
|
-
- Security settings are insufficient for production
|
299
|
-
- CORS configuration conflicts
|
300
|
-
- SSL/TLS configuration problems
|
301
|
-
- Security domain validation failures
|
302
|
-
"""
|
303
|
-
|
304
|
-
def __init__(
|
305
|
-
self,
|
306
|
-
message: str,
|
307
|
-
security_setting: Optional[str] = None,
|
308
|
-
severity: str = "medium",
|
309
|
-
**kwargs
|
310
|
-
) -> None:
|
311
|
-
"""
|
312
|
-
Initialize security error.
|
313
|
-
|
314
|
-
Args:
|
315
|
-
message: Error description
|
316
|
-
security_setting: Security setting that caused the error
|
317
|
-
severity: Error severity (low, medium, high, critical)
|
318
|
-
**kwargs: Additional context passed to base class
|
319
|
-
"""
|
320
|
-
context = kwargs.get('context', {})
|
321
|
-
if security_setting is not None:
|
322
|
-
context['security_setting'] = security_setting
|
323
|
-
context['severity'] = severity
|
324
|
-
|
325
|
-
kwargs['context'] = context
|
326
|
-
super().__init__(message, **kwargs)
|
327
|
-
|
328
|
-
self.security_setting = security_setting
|
329
|
-
self.severity = severity
|
77
|
+
class DatabaseError(DjangoCfgException):
|
78
|
+
"""Raised when database configuration or connection issues occur."""
|
79
|
+
pass
|
330
80
|
|
331
81
|
|
332
|
-
# Exception hierarchy for easy catching
|
333
82
|
__all__ = [
|
334
83
|
"DjangoCfgException",
|
335
|
-
"ConfigurationError",
|
84
|
+
"ConfigurationError",
|
336
85
|
"ValidationError",
|
337
86
|
"EnvironmentError",
|
338
|
-
"IntegrationError",
|
339
|
-
"DatabaseError",
|
340
87
|
"CacheError",
|
341
|
-
"
|
88
|
+
"DatabaseError",
|
342
89
|
]
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"""
|
2
|
+
Django settings generation module.
|
3
|
+
|
4
|
+
Provides settings generation from DjangoConfig instances.
|
5
|
+
|
6
|
+
Main Components:
|
7
|
+
- SettingsGenerator: Main facade for settings generation
|
8
|
+
- SettingsOrchestrator: Coordinates specialized generators
|
9
|
+
- Specialized generators: Core, Data, Integration, Utility
|
10
|
+
|
11
|
+
Architecture:
|
12
|
+
DjangoConfig
|
13
|
+
|
|
14
|
+
v
|
15
|
+
SettingsGenerator (facade)
|
16
|
+
|
|
17
|
+
v
|
18
|
+
SettingsOrchestrator
|
19
|
+
|
|
20
|
+
+-> CoreSettingsGenerator
|
21
|
+
+-> TemplateSettingsGenerator
|
22
|
+
+-> StaticFilesGenerator
|
23
|
+
+-> DatabaseSettingsGenerator
|
24
|
+
+-> CacheSettingsGenerator
|
25
|
+
+-> SecuritySettingsGenerator
|
26
|
+
+-> EmailSettingsGenerator
|
27
|
+
+-> LoggingSettingsGenerator
|
28
|
+
+-> I18nSettingsGenerator
|
29
|
+
+-> LimitsSettingsGenerator
|
30
|
+
+-> SessionSettingsGenerator
|
31
|
+
+-> ThirdPartyIntegrationsGenerator
|
32
|
+
+-> APIFrameworksGenerator
|
33
|
+
+-> TasksSettingsGenerator
|
34
|
+
|
35
|
+
Example:
|
36
|
+
```python
|
37
|
+
from django_cfg import DjangoConfig
|
38
|
+
from django_cfg.core.generation import SettingsGenerator
|
39
|
+
|
40
|
+
config = DjangoConfig(project_name="MyProject", secret_key="x"*50)
|
41
|
+
settings = SettingsGenerator.generate(config)
|
42
|
+
```
|
43
|
+
"""
|
44
|
+
|
45
|
+
from .generation import SettingsGenerator
|
46
|
+
from .orchestrator import SettingsOrchestrator
|
47
|
+
|
48
|
+
__all__ = [
|
49
|
+
"SettingsGenerator",
|
50
|
+
"SettingsOrchestrator",
|
51
|
+
]
|
File without changes
|
@@ -0,0 +1,90 @@
|
|
1
|
+
"""
|
2
|
+
Core Django settings generator.
|
3
|
+
|
4
|
+
Generates fundamental Django settings like SECRET_KEY, DEBUG, INSTALLED_APPS, etc.
|
5
|
+
Size: ~120 lines (focused on core settings)
|
6
|
+
"""
|
7
|
+
|
8
|
+
from typing import Dict, Any, TYPE_CHECKING
|
9
|
+
|
10
|
+
if TYPE_CHECKING:
|
11
|
+
from ...base.config_model import DjangoConfig
|
12
|
+
|
13
|
+
|
14
|
+
class CoreSettingsGenerator:
|
15
|
+
"""
|
16
|
+
Generates core Django settings.
|
17
|
+
|
18
|
+
Responsibilities:
|
19
|
+
- SECRET_KEY, DEBUG
|
20
|
+
- INSTALLED_APPS (via config.get_installed_apps())
|
21
|
+
- MIDDLEWARE (via config.get_middleware())
|
22
|
+
- ALLOWED_HOSTS (via config.get_allowed_hosts())
|
23
|
+
- ROOT_URLCONF, WSGI_APPLICATION
|
24
|
+
- AUTH_USER_MODEL
|
25
|
+
- BASE_DIR
|
26
|
+
- DEFAULT_AUTO_FIELD
|
27
|
+
|
28
|
+
Example:
|
29
|
+
```python
|
30
|
+
generator = CoreSettingsGenerator(config)
|
31
|
+
settings = generator.generate()
|
32
|
+
```
|
33
|
+
"""
|
34
|
+
|
35
|
+
def __init__(self, config: "DjangoConfig"):
|
36
|
+
"""
|
37
|
+
Initialize generator with configuration.
|
38
|
+
|
39
|
+
Args:
|
40
|
+
config: DjangoConfig instance
|
41
|
+
"""
|
42
|
+
self.config = config
|
43
|
+
|
44
|
+
def generate(self) -> Dict[str, Any]:
|
45
|
+
"""
|
46
|
+
Generate core Django settings.
|
47
|
+
|
48
|
+
Returns:
|
49
|
+
Dictionary with core Django settings
|
50
|
+
|
51
|
+
Example:
|
52
|
+
>>> config = DjangoConfig(project_name="Test", secret_key="x"*50)
|
53
|
+
>>> generator = CoreSettingsGenerator(config)
|
54
|
+
>>> settings = generator.generate()
|
55
|
+
>>> "SECRET_KEY" in settings
|
56
|
+
True
|
57
|
+
"""
|
58
|
+
settings = {
|
59
|
+
"SECRET_KEY": self.config.secret_key,
|
60
|
+
"DEBUG": self.config.debug,
|
61
|
+
"ALLOWED_HOSTS": self.config.get_allowed_hosts(),
|
62
|
+
"INSTALLED_APPS": self.config.get_installed_apps(),
|
63
|
+
"MIDDLEWARE": self.config.get_middleware(),
|
64
|
+
}
|
65
|
+
|
66
|
+
# Add URL configuration
|
67
|
+
if self.config.root_urlconf:
|
68
|
+
settings["ROOT_URLCONF"] = self.config.root_urlconf
|
69
|
+
|
70
|
+
if self.config.wsgi_application:
|
71
|
+
settings["WSGI_APPLICATION"] = self.config.wsgi_application
|
72
|
+
|
73
|
+
# Add custom user model
|
74
|
+
if self.config.auth_user_model:
|
75
|
+
settings["AUTH_USER_MODEL"] = self.config.auth_user_model
|
76
|
+
elif self.config.enable_accounts:
|
77
|
+
# Auto-use django-cfg accounts CustomUser if accounts is enabled
|
78
|
+
settings["AUTH_USER_MODEL"] = "django_cfg_accounts.CustomUser"
|
79
|
+
|
80
|
+
# Add base directory
|
81
|
+
if self.config._base_dir:
|
82
|
+
settings["BASE_DIR"] = self.config._base_dir
|
83
|
+
|
84
|
+
# Add default auto field
|
85
|
+
settings["DEFAULT_AUTO_FIELD"] = "django.db.models.BigAutoField"
|
86
|
+
|
87
|
+
return settings
|
88
|
+
|
89
|
+
|
90
|
+
__all__ = ["CoreSettingsGenerator"]
|
@@ -0,0 +1,82 @@
|
|
1
|
+
"""
|
2
|
+
Static files settings generator.
|
3
|
+
|
4
|
+
Handles STATIC_*, MEDIA_*, and WhiteNoise configuration.
|
5
|
+
Size: ~70 lines (focused on static files)
|
6
|
+
"""
|
7
|
+
|
8
|
+
from typing import Dict, Any, TYPE_CHECKING
|
9
|
+
|
10
|
+
if TYPE_CHECKING:
|
11
|
+
from ...base.config_model import DjangoConfig
|
12
|
+
|
13
|
+
|
14
|
+
class StaticFilesGenerator:
|
15
|
+
"""
|
16
|
+
Generates static files settings.
|
17
|
+
|
18
|
+
Responsibilities:
|
19
|
+
- STATIC_URL, STATIC_ROOT, STATICFILES_DIRS
|
20
|
+
- MEDIA_URL, MEDIA_ROOT
|
21
|
+
- WhiteNoise configuration
|
22
|
+
- Static files finders
|
23
|
+
|
24
|
+
Example:
|
25
|
+
```python
|
26
|
+
generator = StaticFilesGenerator(config)
|
27
|
+
settings = generator.generate()
|
28
|
+
```
|
29
|
+
"""
|
30
|
+
|
31
|
+
def __init__(self, config: "DjangoConfig"):
|
32
|
+
"""
|
33
|
+
Initialize generator with configuration.
|
34
|
+
|
35
|
+
Args:
|
36
|
+
config: DjangoConfig instance
|
37
|
+
"""
|
38
|
+
self.config = config
|
39
|
+
|
40
|
+
def generate(self) -> Dict[str, Any]:
|
41
|
+
"""
|
42
|
+
Generate static files settings.
|
43
|
+
|
44
|
+
Returns:
|
45
|
+
Dictionary with static files configuration
|
46
|
+
|
47
|
+
Example:
|
48
|
+
>>> generator = StaticFilesGenerator(config)
|
49
|
+
>>> settings = generator.generate()
|
50
|
+
>>> "STATIC_URL" in settings
|
51
|
+
True
|
52
|
+
"""
|
53
|
+
settings = {
|
54
|
+
"STATIC_URL": "/static/",
|
55
|
+
"MEDIA_URL": "/media/",
|
56
|
+
# WhiteNoise configuration
|
57
|
+
"STATICFILES_STORAGE": "whitenoise.storage.CompressedManifestStaticFilesStorage",
|
58
|
+
"WHITENOISE_USE_FINDERS": True,
|
59
|
+
"WHITENOISE_AUTOREFRESH": self.config.debug,
|
60
|
+
"WHITENOISE_MAX_AGE": 0 if self.config.debug else 3600, # No cache in debug, 1 hour in prod
|
61
|
+
}
|
62
|
+
|
63
|
+
# Set paths relative to base directory
|
64
|
+
if self.config._base_dir:
|
65
|
+
settings.update({
|
66
|
+
"STATIC_ROOT": self.config._base_dir / "staticfiles",
|
67
|
+
"MEDIA_ROOT": self.config._base_dir / "media",
|
68
|
+
"STATICFILES_DIRS": [
|
69
|
+
self.config._base_dir / "static",
|
70
|
+
],
|
71
|
+
})
|
72
|
+
|
73
|
+
# Static files finders
|
74
|
+
settings["STATICFILES_FINDERS"] = [
|
75
|
+
"django.contrib.staticfiles.finders.FileSystemFinder",
|
76
|
+
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
77
|
+
]
|
78
|
+
|
79
|
+
return settings
|
80
|
+
|
81
|
+
|
82
|
+
__all__ = ["StaticFilesGenerator"]
|