mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 08:26:03 +00:00
refactor: settings are read through django.conf
instances/forms.py and instances/models.py imported values from the webvirtcloud.settings module itself, which bypasses DJANGO_SETTINGS_MODULE (settings-dev, test overrides) and runs the module a second time. They now read django.conf.settings. webvirtcloud/urls.py also loses its fallback that set REST_FRAMEWORK's schema class at import for settings.py copies without it: the template sets it, and an older settings.py is rebuilt from the template when updating.
This commit is contained in:
parent
2440c9eaf7
commit
abe3b7ee63
3 changed files with 4 additions and 16 deletions
|
|
@ -9,17 +9,6 @@ from appsettings.views import appsettings
|
|||
from console.views import console
|
||||
from instances.views import index
|
||||
|
||||
# Fallback for existing installations where REST_FRAMEWORK.DEFAULT_SCHEMA_CLASS is not configured in settings.py
|
||||
user_rf = getattr(settings, "REST_FRAMEWORK", None)
|
||||
if not user_rf or "DEFAULT_SCHEMA_CLASS" not in user_rf:
|
||||
try:
|
||||
from rest_framework.settings import api_settings
|
||||
from drf_spectacular.openapi import AutoSchema
|
||||
|
||||
api_settings.DEFAULT_SCHEMA_CLASS = AutoSchema
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
urlpatterns = [
|
||||
path("", index, name="index"),
|
||||
path("admin/", include(("admin.urls", "admin"), namespace="admin")),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue