# from apscheduler.schedulers.background import BackgroundScheduler

import django
import os

# # Ensure the Django settings are configured before importing the models
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'school.settings')
django.setup()

from myapp.models import Profiles  # Adjust 'myapp' to the actual name of your app


import django
import pyodbc
import os
from django.utils import timezone
# # Ensure the Django settings are configured before importing the models
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'school.settings')
django.setup()

from myapp.models import Profiles,Attendance  # Adjust 'myapp' to the actual name of your app

from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime, timedelta
now = datetime.now()
time = datetime.now().strftime('%H-%M')



    

    


def attendance1():
    sched = BackgroundScheduler()
    sched.add_job(attendance, 'cron',hour=16, minute=39)
    sched.start()

def attendance():


    print('attendance')
    
    try:
        # Fetch a single profile instance
      
        print('Profile status updated to 2')
    except Profiles.DoesNotExist:
        print('Profile not found')
    return "attendance"