mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-25 01:58:54 +02:00
@@ -49,7 +49,7 @@ async def remove_expired_sessions(timestamp=None):
|
|||||||
def reset_demo_data(timestamp=None):
|
def reset_demo_data(timestamp=None):
|
||||||
"""
|
"""
|
||||||
Wipes the database and loads fresh demo data if DEMO mode is active.
|
Wipes the database and loads fresh demo data if DEMO mode is active.
|
||||||
Runs daily at 6:00 AM.
|
Runs daily at 8:00 AM.
|
||||||
"""
|
"""
|
||||||
if not settings.DEMO:
|
if not settings.DEMO:
|
||||||
return # Exit if not in demo mode
|
return # Exit if not in demo mode
|
||||||
@@ -59,13 +59,14 @@ def reset_demo_data(timestamp=None):
|
|||||||
try:
|
try:
|
||||||
# 1. Flush the database (wipe all data)
|
# 1. Flush the database (wipe all data)
|
||||||
logger.info("Flushing the database...")
|
logger.info("Flushing the database...")
|
||||||
# Using --noinput prevents prompts. Specify database if not default.
|
|
||||||
management.call_command(
|
management.call_command(
|
||||||
"flush", "--noinput", database=DEFAULT_DB_ALIAS, verbosity=1
|
"flush", "--noinput", database=DEFAULT_DB_ALIAS, verbosity=1
|
||||||
)
|
)
|
||||||
logger.info("Database flushed successfully.")
|
logger.info("Database flushed successfully.")
|
||||||
|
|
||||||
# 2. Load data from the fixture
|
# 2. Load data from the fixture
|
||||||
|
# TO-DO: Roll dates over based on today's date
|
||||||
fixture_name = "fixtures/demo_data.json"
|
fixture_name = "fixtures/demo_data.json"
|
||||||
logger.info(f"Loading data from fixture: {fixture_name}...")
|
logger.info(f"Loading data from fixture: {fixture_name}...")
|
||||||
management.call_command(
|
management.call_command(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user