Skip to content

Commit

Permalink
Clear cache when resetting demo
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne authored and laymonage committed Jul 25, 2023
1 parent 0c58f47 commit ec5a5f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bakerydemo/base/management/commands/reset_demo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings
from django.core.cache import caches
from django.core.files.storage import default_storage
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
Expand Down Expand Up @@ -33,8 +34,12 @@ def handle(self, **options):
# 3. Rebuild database
call_command("migrate", interactive=False)

# 4. Re-import data
# 4. Clear caches
for cache in caches.all():
cache.clear()

# 5. Re-import data
call_command("load_initial_data")

# 5. Change the admin password (in case it's different in this environment)
# 6. Change the admin password (in case it's different in this environment)
call_command("reset_admin_password")

0 comments on commit ec5a5f8

Please # to comment.