from django.conf import settings

from . import api, app_urls, sys_urls

try:
    error_config = settings.GLOBAL_CONFIG.get('AuxiliaryConfig',
                                              {}).get('error_switch', True)
except:
    error_config = True
if error_config:
    from apps.core.views.error import custom_error_view
    from django.conf.urls import handler404, handler500

    handler400 = lambda request, exception: custom_error_view(
        request, 400, exception)
    handler403 = lambda request, exception: custom_error_view(
        request, 403, exception)
    handler404 = lambda request, exception: custom_error_view(
        request, 404, exception)
    handler500 = lambda request: custom_error_view(request, 500)
    handler502 = lambda request, exception=None: custom_error_view(
        request, 502, exception)
urlpatterns = [
    *api.urlpatterns,
    *sys_urls.urlpatterns,
    *app_urls.urlpatterns,

    # 可选：第三方插件路由
    # path('auth/', include('rest_framework.urls')),
]
