Spaces:
Sleeping
Sleeping
File size: 694 Bytes
0310410 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import os
import sys
from django.apps import AppConfig
class CoreConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.core"
def ready(self):
is_runserver = len(sys.argv) > 1 and sys.argv[1] == "runserver"
if not is_runserver:
return
# With autoreload (default), only start in the child process.
# With --noreload, RUN_MAIN is never set so start directly.
uses_autoreload = "--noreload" not in sys.argv
if uses_autoreload and os.environ.get("RUN_MAIN") != "true":
return
from .tasks import start_stock_fetcher
start_stock_fetcher()
|