A web application for tracking AMC (Annual Maintenance Contract) and license expiry dates for clients, with automated notification capabilities.
- Client Management: Add, edit, and manage client information
- AMC Tracking: Track AMC start and end dates for each client
- License Tracking: Track software license details including expiry dates
- Notification System: Automated email notifications for expiring AMCs and licenses
- Microsoft 365 Single Sign-On: Secure authentication using company Microsoft accounts
- SendGrid Integration: Email notifications via SendGrid API
- Responsive Design: Works on desktop and mobile devices
- Backend: Django 5.2
- Frontend: Bootstrap 5, jQuery
- Authentication: Microsoft Authentication Library (MSAL)
- Email Service: SendGrid
- Database: SQLite (default), can be configured for other databases
-
Clone the repository:
git clone <repository-url> cd AMC_Tracker -
Create a virtual environment and activate it:
python -m venv venv .\venv\Scripts\activate # Windows source venv/bin/activate # Linux/Mac -
Install dependencies:
pip install -r requirements.txt -
Configure environment variables:
SENDGRID_API_KEY: Your SendGrid API keyDEFAULT_FROM_EMAIL: Default sender email for notificationsMSAL_CLIENT_ID: Microsoft application client IDMSAL_CLIENT_SECRET: Microsoft application client secretMSAL_REDIRECT_URI: Redirect URI for Microsoft authentication
-
Run migrations:
python manage.py migrate -
Create a superuser:
python manage.py createsuperuser -
Run the development server:
python manage.py runserver
The AMC Tracker application includes a built-in notification system that automatically checks for and sends email notifications about expiring AMCs and licenses. The system:
- Uses HTML email templates for better-looking notifications
- Sends notifications for items expiring within 30 days
- Tracks notification status with the is_sent field
- Runs automatically through a middleware that checks if notifications need to be sent daily
- Stores the last run time in a JSON file to avoid sending duplicate notifications
- Avoids sending duplicate notifications by checking if a notification for the same client and item type has been sent within the notification threshold period
This implementation doesn't rely on external task schedulers or dependencies, making it suitable for both local and cloud hosting environments.
You can also manually trigger notification checks by:
- Navigating to the Notification Settings page
- Clicking the "Check Notifications Now" button
- Create a Heroku account if you don't have one
- Install the Heroku CLI
- Login to Heroku:
heroku login - Create a new Heroku app:
heroku create amc-tracker - Add PostgreSQL add-on:
heroku addons:create heroku-postgresql:hobby-dev - Configure environment variables:
heroku config:set SECRET_KEY=your-secret-key heroku config:set DEBUG=False heroku config:set SENDGRID_API_KEY=your-sendgrid-api-key heroku config:set DEFAULT_FROM_EMAIL=your-email@example.com heroku config:set MSAL_CLIENT_ID=your-microsoft-client-id heroku config:set MSAL_CLIENT_SECRET=your-microsoft-client-secret heroku config:set MSAL_REDIRECT_URI=https://your-app-name.herokuapp.com/auth/callback - Deploy the application:
git push heroku main - Run migrations:
heroku run python manage.py migrate - Create a superuser:
heroku run python manage.py createsuperuser
The application can also be deployed to other platforms like:
- AWS Elastic Beanstalk
- DigitalOcean App Platform
- PythonAnywhere
- Railway
Make sure to configure the environment variables appropriately for your chosen platform.
- Access the admin interface at
http://localhost:8000/admin/to set up initial data - Configure notification settings and SendGrid API details
- Add clients, AMCs, and licenses through the web interface
- The system will automatically send notifications for items expiring within the configured timeframe
- Register a new application in the Azure Portal
- Set the redirect URI to match your application's callback URL
- Grant the necessary permissions (User.Read, email, profile, openid)
- Update the environment variables with your application's credentials
This project is licensed under the MIT License - see the LICENSE file for details.