...content from GitHub...
origin/main
This Django project monitors website uptime and sends Email and Twilio SMS alerts when a site is down for more than 2 minutes, then notifies again when it recovers.
- Periodic health checks (via
django-crontab) - Alerts via Email and Twilio SMS
- Auto-seeded demo sites (
Google,Example,InvalidSite) - Celery
- Redis
git clone <this repo> SiteCareGuard
cd SiteCareGuard
pip install -r requirements.txtIf you are using a virtual environment:
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on WindowsCreate a file named .env in your project root (or copy from .env.example):
cp .env.example .envThen fill in your credentials:
# Twilio (for SMS alerts)
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
TWILIO_FROM_NUMBER=+1234567890
# Email (for email alerts)
EMAIL_HOST_USER=your_email@gmail.com
EMAIL_HOST_PASSWORD=your_app_password
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
# Django secret key if needed
SECRET_KEY=django-insecure-xxxxxx
python manage.py makemigrations
python manage.py migrateAdd sample websites (2 working, 1 broken):
python manage.py seed_test_sitesThen open Django Admin or run a manual check:
python manage.py check_websitesIf “InvalidSite” stays down for 2+ minutes, you’ll get both an Email and SMS alert.
The project uses django-crontab to schedule checks every minute:
python manage.py crontab add
python manage.py crontab show # verify it’s listedTo remove:
python manage.py crontab removeYou can manage websites in the Django admin.
python manage.py createsuperuser
python manage.py runserverThen visit: http://127.0.0.1:8000/admin/
- Cron logs are typically in system logs (
/var/log/syslogon Linux, or Task Scheduler on Windows). - All alerts also log through Django’s
loggingsystem. - To test SMS, ensure your Twilio number and recipient are verified (for trial accounts).
python manage.py crontab remove
deactivate # if using virtual envDjango >= 5.x
twilio >= 8.0.0
django-crontab >= 0.8.0
requests
This repository will contain the code and resources for the AIORI-2 hackathon that will be developed during the AIORI-2
a68ab50d5ebd8e37133e61f775240cdc823818cf