This commit is contained in:
39
backend/config/urls.py
Normal file
39
backend/config/urls.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.http import JsonResponse
|
||||
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
|
||||
from competition import judge_views
|
||||
|
||||
# 健康检查视图
|
||||
def health_check(request):
|
||||
return JsonResponse({
|
||||
'status': 'healthy',
|
||||
'service': '创赢未来报名评分系统',
|
||||
'version': '1.0.0'
|
||||
})
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/health/', health_check, name='health_check'),
|
||||
|
||||
# Judge System Routes
|
||||
path('judge/', include('competition.judge_urls')),
|
||||
path('competition/admin/', judge_views.admin_entry, name='judge_admin_entry_root'),
|
||||
|
||||
path('api/', include('shop.urls')),
|
||||
path('api/community/', include('community.urls')),
|
||||
path('api/competition/', include('competition.urls')),
|
||||
path('api/ai/', include('ai_services.urls')),
|
||||
|
||||
# Swagger文档路由
|
||||
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
|
||||
path('api/docs/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
|
||||
path('api/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
|
||||
]
|
||||
|
||||
# 静态文件配置(开发环境)
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
Reference in New Issue
Block a user