fix:urls and debug option

This commit is contained in:
bbh
2025-09-11 01:17:14 +08:00
parent 0d09225c7e
commit 1fbe7f8a5e
2 changed files with 7 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-6ehh*7^wfs=d6cwcddgqu_0k)da%%ph(8gdh0_-)v#9pm4rikz' SECRET_KEY = 'django-insecure-6ehh*7^wfs=d6cwcddgqu_0k)da%%ph(8gdh0_-)v#9pm4rikz'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']

View File

@@ -20,6 +20,9 @@ from rest_framework import permissions
from drf_yasg.views import get_schema_view from drf_yasg.views import get_schema_view
from drf_yasg import openapi from drf_yasg import openapi
from django.conf import settings
from django.conf.urls.static import static
schema_view = get_schema_view( schema_view = get_schema_view(
@@ -44,3 +47,6 @@ urlpatterns = [
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
] ]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)