This commit is contained in:
@ -1,16 +1,38 @@
|
||||
"""
|
||||
WSGI config for butler_ddochi project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# ✅ Django 설정을 미리 불러온다
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'butler_ddochi.settings')
|
||||
|
||||
from django.conf import settings # <<<< 이거 추가
|
||||
|
||||
# ✅ DEBUG 모드 아닐 때만 OpenTelemetry 초기화
|
||||
if not settings.DEBUG:
|
||||
from opentelemetry import trace
|
||||
from opentelemetry.sdk.resources import Resource
|
||||
from opentelemetry.sdk.trace import TracerProvider
|
||||
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
||||
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
||||
from opentelemetry.instrumentation.django import DjangoInstrumentor
|
||||
|
||||
trace.set_tracer_provider(
|
||||
TracerProvider(
|
||||
resource=Resource.create({
|
||||
"service.name": "butler_ddochi",
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
otlp_exporter = OTLPSpanExporter(
|
||||
endpoint="http://jaeger-collector:4317",
|
||||
insecure=True,
|
||||
)
|
||||
|
||||
trace.get_tracer_provider().add_span_processor(
|
||||
BatchSpanProcessor(otlp_exporter)
|
||||
)
|
||||
|
||||
DjangoInstrumentor().instrument()
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'butler_ddochi.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
16
butler_ddochi/wsgi.py.backup
Normal file
16
butler_ddochi/wsgi.py.backup
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for butler_ddochi project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'butler_ddochi.settings')
|
||||
|
||||
application = get_wsgi_application()
|
Reference in New Issue
Block a user