32 lines
892 B
Python
32 lines
892 B
Python
from django.conf import settings
|
|
from django.urls import include, re_path
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
|
|
from api.schema_public import schema
|
|
|
|
from core.views import SentryGraphQLView, PrivateGraphQLView
|
|
|
|
app_name = "api"
|
|
urlpatterns = [
|
|
re_path(r"^graphql-public", csrf_exempt(SentryGraphQLView.as_view(schema=schema))),
|
|
re_path(r"^graphql", csrf_exempt(PrivateGraphQLView.as_view())),
|
|
# oauth
|
|
re_path(r"^oauth/", include("oauth.urls", namespace="oauth")),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
urlpatterns += [
|
|
re_path(
|
|
r"^graphiql-public",
|
|
csrf_exempt(
|
|
SentryGraphQLView.as_view(schema=schema, graphiql=True, pretty=True)
|
|
),
|
|
)
|
|
]
|
|
urlpatterns += [
|
|
re_path(
|
|
r"^graphiql",
|
|
csrf_exempt(PrivateGraphQLView.as_view(graphiql=True, pretty=True)),
|
|
)
|
|
]
|