Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.django-alpine
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ COPY \
docker/reach_broker.sh \
docker/certs/* \
/
COPY wsgi.py manage.py ./
COPY manage.py ./
COPY dojo/ ./dojo/

# Add extra fixtures to docker image which are loaded by the initializer
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.django-debian
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ COPY \
docker/reach_broker.sh \
docker/certs/* \
/
COPY wsgi.py manage.py ./
COPY manage.py ./
COPY dojo/ ./dojo/

# Add extra fixtures to docker image which are loaded by the initializer
Expand Down
7 changes: 7 additions & 0 deletions dojo/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

from django.apps import AppConfig
from django.conf import settings
from django.core.checks import register as register_check
from django.db import models
from watson import search as watson
Expand All @@ -16,6 +17,12 @@ class DojoAppConfig(AppConfig):
verbose_name = "Defect Dojo"

def ready(self):
if settings.ENABLE_AUDITLOG:
from auditlog.registry import auditlog # noqa: PLC0415 raised: AppRegistryNotReady

from dojo.location.models import Location # noqa: PLC0415 raised: AppRegistryNotReady

auditlog.register(Location)
# we need to initializer waston here because in models.py is to early if we want add extra fields to index
# logger.info('ready(): initializing watson')
# commented out ^ as it prints in manage.py dumpdata, docker logs and many other places
Expand Down
6 changes: 0 additions & 6 deletions dojo/location/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from typing import TYPE_CHECKING, Self, TypeVar

from auditlog.registry import auditlog
from django.db import transaction
from django.db.models import (
CASCADE,
Expand Down Expand Up @@ -34,7 +33,6 @@
)
from dojo.location.status import FindingLocationStatus, ProductLocationStatus
from dojo.models import Dojo_User, Finding, Product, _manage_inherited_tags, copy_model_util
from dojo.settings import settings
from dojo.tools.locations import LocationAssociationData

if TYPE_CHECKING:
Expand Down Expand Up @@ -454,7 +452,3 @@ class Meta:
def __str__(self) -> str:
"""Return the string representation of a LocationProductReference."""
return f"{self.location} - Product: {self.product} ({self.status})"


if settings.ENABLE_AUDITLOG:
auditlog.register(Location)
2 changes: 1 addition & 1 deletion dojo/reports/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import OrderedDict

from django import forms
from django.conf import settings
from django.forms import Widget
from django.forms.utils import flatatt
from django.http import QueryDict
Expand All @@ -23,7 +24,6 @@
from dojo.location.status import FindingLocationStatus
from dojo.models import Endpoint, Finding
from dojo.reports.queries import prefetch_related_endpoints_for_report, prefetch_related_findings_for_report
from dojo.settings import settings
from dojo.url.filters import URLFilter
from dojo.utils import get_page_items, get_system_setting, get_words_for_field

Expand Down
35 changes: 0 additions & 35 deletions wsgi.py

This file was deleted.