Replaced `django-prometheus` with the default Django components, including model mixins, database backends, and cache configuration. This change simplifies monitoring setup by removing unnecessary dependencies, reducing overhead, and improving compatibility. **Details:** - Removed Prometheus metrics endpoints and middleware. - Updated database, cache, and model configurations to remove `django-prometheus`. - Adjusted WSGI settings to integrate OpenTelemetry instrumentation instead of Prometheus. - Updated dependency files and migration schemas accordingly.
115 lines
2.9 KiB
Python
115 lines
2.9 KiB
Python
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
from django.contrib import admin
|
|
from django.urls import include, path
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
from health_check.views import HealthCheckView
|
|
from redis.asyncio import Redis as RedisClient
|
|
|
|
from engine.core.graphene.schema import schema
|
|
from engine.core.views import (
|
|
CustomGraphQLView,
|
|
CustomSpectacularAPIView,
|
|
RapiDocView,
|
|
favicon_view,
|
|
index,
|
|
)
|
|
from schon.i18n import set_language
|
|
|
|
urlpatterns = [
|
|
### COMMON URLS ###
|
|
path(
|
|
r"",
|
|
index,
|
|
),
|
|
path(
|
|
"health/",
|
|
HealthCheckView.as_view(
|
|
checks=[
|
|
"health_check.Cache",
|
|
"health_check.DNS",
|
|
"health_check.Database",
|
|
"health_check.Mail",
|
|
"health_check.Storage",
|
|
"health_check.contrib.psutil.Disk",
|
|
"health_check.contrib.psutil.Memory",
|
|
"health_check.contrib.celery.Ping",
|
|
(
|
|
"health_check.contrib.redis.Redis",
|
|
{
|
|
"client_factory": lambda: RedisClient.from_url(
|
|
settings.CELERY_BROKER_URL
|
|
)
|
|
},
|
|
),
|
|
],
|
|
),
|
|
name="health_check",
|
|
),
|
|
path(
|
|
r"i18n/setlang/",
|
|
set_language,
|
|
name="set_language",
|
|
),
|
|
path(
|
|
r"i18n/",
|
|
include("django.conf.urls.i18n"),
|
|
),
|
|
path(
|
|
r"favicon.ico",
|
|
favicon_view,
|
|
name="favicon",
|
|
),
|
|
path(
|
|
r"graphql/",
|
|
csrf_exempt(CustomGraphQLView.as_view(graphiql=True, schema=schema)),
|
|
name="graphql-platform",
|
|
),
|
|
### DOCUMENTATION URLS ###
|
|
path(
|
|
r"docs/",
|
|
RapiDocView.as_view(),
|
|
name="rapidoc-platform",
|
|
),
|
|
path(
|
|
r"docs/schema/",
|
|
CustomSpectacularAPIView.as_view(urlconf="schon.urls"),
|
|
name="schema-platform",
|
|
),
|
|
### ENGINE APPS URLS ###
|
|
path(
|
|
r"b2b/",
|
|
include("engine.core.b2b_urls", namespace="core_b2b"),
|
|
),
|
|
path(
|
|
r"",
|
|
include("engine.core.urls", namespace="core"),
|
|
),
|
|
path(
|
|
r"authv/",
|
|
include("engine.vibes_auth.urls", namespace="vibes_auth"),
|
|
),
|
|
path(
|
|
r"payments/",
|
|
include("engine.payments.urls", namespace="payments"),
|
|
),
|
|
path(
|
|
r"blog/",
|
|
include("engine.blog.urls", namespace="blog"),
|
|
),
|
|
### ADMIN URLS ###
|
|
path(
|
|
"admin/doc/",
|
|
include("django.contrib.admindocs.urls"),
|
|
),
|
|
path(
|
|
"admin/",
|
|
admin.site.urls,
|
|
),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
from debug_toolbar.toolbar import debug_toolbar_urls
|
|
|
|
urlpatterns += debug_toolbar_urls()
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|