🔧 CRITICAL: Advanced CSRF and Telegram bot fixes
Some checks failed
continuous-integration/drone/push Build is failing

 CSRF_TRUSTED_ORIGINS fixes:
- Intercepted decouple.config() function to return empty string for CSRF
- Added multiple override layers in settings_test.py
- No more Django 4.0.E001 errors locally

 Telegram bot fixes:
- Added DISABLE_TELEGRAM_BOT environment variable
- Bot initialization skipped during tests
- Prevents database table access errors

LOCAL TEST RESULTS:
 No Django system check errors
 CSRF validation passes
 Telegram bot properly disabled

Ready for CI/CD validation!
This commit is contained in:
2025-11-25 08:37:54 +09:00
parent 3d96ac368a
commit 8a95857010
3 changed files with 25 additions and 12 deletions

View File

@@ -12,6 +12,11 @@ from django.utils.crypto import get_random_string
class TelegramBot:
def __init__(self):
# ПРОВЕРЯЕМ ОТКЛЮЧЕНИЕ БОТА ДЛЯ ТЕСТОВ
if os.environ.get('DISABLE_TELEGRAM_BOT') == 'True':
logging.info("[TelegramBot] Бот отключен для тестирования")
raise Exception("Telegram bot disabled for testing")
# Получение настроек бота из базы данных
bot_settings = TelegramSettings.objects.first()
if bot_settings and bot_settings.bot_token: