start_agent_alert_manager.py
730 Bytes
#!/usr/bin/env python3
import os
import sys
# To avoid a "ModuleNotFoundError: No module named 'dashboard'"... (not even 1 app found) :
sys.path.insert(0, os.path.abspath(".."))
# To avoid a "ModuleNotFoundError: No module named 'src'"
sys.path.append('..')
print("Starting with this sys.path", sys.path)
# DJANGO setup
# Go into src/
os.chdir('..')
#print("Current directory : " + str(os.getcwd()))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.pyros.settings")
#os.environ['SECRET_KEY'] = 'abc'
#os.environ['ENVIRONMENT'] = 'production'
import django
django.setup()
# MONITORING AGENT setup
agent="alert_manager"
if agent=="alert_manager":
from alert_manager.tasks import AlertListener
AlertListener().run()