21 lines
820 B
Python
21 lines
820 B
Python
from django.contrib import admin
|
|
from django.urls import path, include
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
|
|
|
|
urlpatterns = [
|
|
path('admin/', admin.site.urls),
|
|
path('api/', include('shop.urls')),
|
|
path('api/community/', include('community.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)
|