import base64 import json import os import urllib.request from distutils.util import strtobool from celery.schedules import crontab from sentry_sdk.integrations.django import DjangoIntegration from django.conf.locale.en import formats as en_formats import sentry from dataworkspace.utils import normalise_environment sentry.init_sentry(integration=DjangoIntegration()) env = normalise_environment(os.environ) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ENVIRONMENT = env.get("ENVIRONMENT", "Dev") SECRET_KEY = env['SECRET_KEY'] LOCAL = 'dataworkspace.test' in env['ALLOWED_HOSTS'] DEBUG = bool(strtobool(env.get('DEBUG', str(LOCAL)))) def aws_fargate_private_ip(): with urllib.request.urlopen( 'http://169.254.170.2/v2/metadata') as response: return json.loads(response.read().decode(
from sentry import init_sentry # Initialize Sentry, want to do as early as possible init_sentry() from mangum import Mangum from lumina.app import app handler = Mangum(app)
def main(): init_sentry(integration=AioHttpIntegration()) loop = asyncio.get_event_loop() loop.run_until_complete(async_main())
from celery.schedules import crontab from sentry_sdk.integrations.aiohttp import AioHttpIntegration from sentry_sdk.integrations.celery import CeleryIntegration from sentry_sdk.integrations.django import DjangoIntegration from sentry_sdk.integrations.redis import RedisIntegration from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration from django.conf.locale.en import formats as en_formats import sentry from dataworkspace.utils import normalise_environment sentry.init_sentry(integrations=[ AioHttpIntegration(), DjangoIntegration(), RedisIntegration(), CeleryIntegration(), SqlalchemyIntegration(), ]) env = normalise_environment(os.environ) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ENVIRONMENT = env.get("ENVIRONMENT", "Dev") SECRET_KEY = env["SECRET_KEY"] LOCAL = "dataworkspace.test" in env["ALLOWED_HOSTS"] DEBUG = bool(strtobool(env.get("DEBUG", str(LOCAL)))) def aws_fargate_private_ip():