Skip to content

Commit

Permalink
Fixes: #18021 - Clear Swagger/drf-spectacular API cache on startup (#…
Browse files Browse the repository at this point in the history
…18174)

* Clear Swagger API cache on startup

* Clear entire Redis cache on startup if DEBUG=True
  • Loading branch information
bctiemann authored Dec 12, 2024
1 parent bd5e7a8 commit dbaa9c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions netbox/core/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.apps import AppConfig
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.db.migrations.operations import AlterModelOptions

Expand All @@ -22,3 +24,7 @@ def ready(self):

# Register models
register_models(*self.get_models())

# Clear Redis cache on startup in development mode
if settings.DEBUG:
cache.clear()

0 comments on commit dbaa9c1

Please sign in to comment.