I can trigger a failure to load swagger when SECRET_KEY in django's settings.py file is changed. There is no such failure with redoc, though there are some load failures.
[05/Feb/2020 19:52:03] "GET / HTTP/1.1" 200 1645
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/style.css HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui.css HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/url-polyfill.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/swagger-ui-init.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui-bundle.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui-standalone-preset.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/insQ.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/immutable.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui-standalone-preset.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/insQ.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/immutable.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/url-polyfill.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:52:03] "GET /static/drf-yasg/swagger-ui-init.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:06] "GET /swagger/ HTTP/1.1" 200 1645
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/style.css HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui.css HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/url-polyfill.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui-bundle.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui-standalone-preset.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/swagger-ui-init.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/insQ.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/immutable.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/swagger-ui-dist/swagger-ui-standalone-preset.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/insQ.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/immutable.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/url-polyfill.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:07] "GET /static/drf-yasg/swagger-ui-init.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:10] "GET /redoc/ HTTP/1.1" 200 994
[05/Feb/2020 19:54:11] "GET /static/drf-yasg/insQ.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:11] "GET /static/drf-yasg/url-polyfill.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:11] "GET /static/drf-yasg/style.css HTTP/1.1" 404 179
[05/Feb/2020 19:54:11] "GET /static/drf-yasg/url-polyfill.min.js HTTP/1.1" 404 179
[05/Feb/2020 19:54:12] "GET /redoc/?format=openapi HTTP/1.1" 200 11593
```{settings.py}
import os
import configparser
secrets_file = configparser.ConfigParser()
secrets_file.read("secrets.cfg")
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = secrets_file["DJANGO"]["secret_key"]
DEBUG = False
ALLOWED_HOSTS = [
"localhost",
"127.0.0.1",
"[::1]",
"10.6.13.185",
"10.4.72.192",
]
INSTALLED_APPS = [
# 'django.contrib.admin',
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"core_lims_adapter.apps.CoreLimsAdapterConfig",
"rest_framework",
"drf_yasg",
]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "lims_rest.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
WSGI_APPLICATION = "lims_rest.wsgi.application"
AUTH_PASSWORD_VALIDATORS = [
]
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = "/static/"
REST_FRAMEWORK = {
"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.AllowAny"],
"UNAUTHENTICATED_USER": None,
}
SWAGGER_SETTINGS = {
"SECURITY_DEFINITIONS": {"basic": {"type": "basic"}},
"USE_SESSION_AUTH": False,
}
```
Very dumb mistake.
so, how to solve this problem?
Most helpful comment
so, how to solve this problem?