Fix release from #1860 (hotfix #1934).

- Cron job to send weekly email report is processed multiple times. Review scheduling process to send to only one worker.
- Implement mechanism to ensure each email is sent only once to each recipient.
- Improve the way the async task is processed by creating a separate task for each organization, instead of processing all organizations in a single task.
posthog/settings.py
"️Environment variable DEBUG is set - PostHog is running in DEVELOPMENT MODE!",
            "Be sure to unset DEBUG if this is supposed to be a PRODUCTION ENVIRONMENT!",
        )
    )
    # Load debug_toolbar if we can
    try:
        import debug_toolbar
    except ImportError:
        pass
    else:
        INSTALLED_APPS.append("debug_toolbar")
        MIDDLEWARE.append("debug_toolbar.middleware.DebugToolbarMiddleware")
if not DEBUG and not TEST and SECRET_KEY == DEFAULT_SECRET_KEY:
    print_warning(
        (
            "You are using the default SECRET_KEY in a production environment!",
            "For the safety of your instance, you must generate and set a unique key.",
            "More information on https://posthog.com/docs/deployment/securing-posthog#secret-key",
        )
    )
    sys.exit("[ERROR] Default SECRET_KEY in production. Stopping Django server…\n")
def show_toolbar(request):
    return request.path.startswith("/api/") or request.path.startswith("/decide/") or request.path.startswith("/e/")
DEBUG_TOOLBAR_CONFIG = {
    "SHOW_TOOLBAR_CALLBACK": "posthog.settings.show_toolbar",
}
# Extend and override these settings with EE's ones
if "ee.apps.EnterpriseConfig" in INSTALLED_APPS:
    from ee.settings import *