def handle(self, *test_labels, **options): modules = utils.create_netdash_modules(settings.NETDASH_MODULES) for m in modules: self.stdout.write(f'{m.name}\n{"-" * len(m.name)}') if not len(m.diagnostics): self.stdout.write(self.style.SUCCESS('No problems found.')) for d in m.diagnostics: self.stdout.write( getattr(self.style, self._styles[d.level])(d.message)) if options['verbosity'] > 1: self.stdout.write( getattr(self.style, self._styles[d.level])(d.traceback)) self.stdout.write('\n')
from django.urls import path, re_path from django.conf import settings from rest_framework.schemas import get_schema_view from drf_yasg.views import get_schema_view as get_yasg_view from drf_yasg import openapi from netdash import utils, views NETDASH_MODULES = utils.create_netdash_modules(settings.NETDASH_MODULES) yasg_view = get_yasg_view( openapi.Info( title='NetDash API', default_version='v1', ), ) schema_view = get_schema_view(title='NetDash API') module_urlpatterns = [module.api_url for module in NETDASH_MODULES if module.api_url] urlpatterns = module_urlpatterns + [ re_path(r'^schema(?P<format>\.json|\.yaml)$', yasg_view.without_ui(cache_timeout=0), name='schema-json'), path('swagger', yasg_view.with_ui('swagger', cache_timeout=0), name='swagger'), path('redoc', yasg_view.with_ui('redoc', cache_timeout=0), name='redoc'), path('', schema_view, name='schema'), path('account/login', views.login) ]
# SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '12345' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['localhost'] CORS_ORIGIN_ALLOW_ALL = False CORS_ORIGIN_WHITELIST = [] NETDASH_MODULES = [ # 'example_devices_netbox_api', ] NETDASH_MODULE_OBJECTS = utils.create_netdash_modules(NETDASH_MODULES) # Application definition INSTALLED_APPS = NETDASH_MODULES + [ 'netdash_api', 'netdash_ui', 'rest_framework', 'drf_yasg', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders',