School Management System Project In Django With Source Code
The School Management System Project In Django is developed using Python Django, This School Management System Django is a Django and sqlite3 based application which provides features such as registering students to the database, monitoring their attendance, their results as well as their related information.
A School Management System In Django runs Django Framework in back-end and HTML, CSS in front-end. It has a interactive dashboard built in for teachers using which teacher can monitor student’s activity in the school like their attendance, result and their enrollment.
Watch the video here to see the full running School Management System In Django with Source Code
This Django School Management System Tutorial also includes a downloadable Project With Source Code for free, just find the downloadable source code below and click to start downloading.
To start creating a School Management System Project In Django, makes sure that you have PyCharm Professional IDE Installed in your computer.
Reminders
To perform this python django project make sure that you have knowledge in the following:
- CSS
- HTML
- Javascript
- Database Management
Features Of This School Management System Project In Django
- Manage Teachers – In this feature the user can manage all the information of teachers including, “add new teacher” , “update or modify teacher” and “delete teacher“.
- Manage Students – In this feature the user can manage all the information of students including, “add new student” , “update or modify student” and “delete student“.
- Manage Students Attendance – In this feature the user can manage the attendance of the students.
- Login/Logout System – In this feature where the user can login and logout to the system.
In This School Management System Project In Django Consist Of The Following Method:
- sms – This method (School Management System) is the min method of the system project.
- accounts – This method is for the registered user of the system that can manage all of the features of the system.
- media – This method you can found the uploading media like “photos” or other media file.
- students – This method is for the students that found all the information of the students.
- teachers – This method is for the teachers that found all the information of the teachers.
- template – This method id for the template design of the system including, “HTML“, “CSS” and etc.
Steps on how to create a School Management System Project In Django With Source Code
School Management System Project In Django With Source Code
- Step 1: Open file.
First , open “pycharm professional” after that click “file” and click “new project“.
- Step 2: Choose Django.
Second, after click “new project“, choose “Django” and click.
- Step 3: Select file location.
Third, select a file location wherever you want.
- Step 4: Create application name.
Fourth, name your application.
- Step 5: Click create.
Fifth, finish creating project by clicking “create” button.
- Step 6: Start of coding.
you are free to copy the following codes below in the given modules and method required.
The List Of Module Given Below Are Under The “sms” Method
- The Code Given Below Is For The “settings.py” Module – you can add the following code below into your “setting.py” under the “sms” method.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', # Our Created Accounts 'accounts.apps.AccountsConfig', 'students.apps.StudentsConfig', 'teachers.apps.TeachersConfig', 'api.apps.ApiConfig', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'sms.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'sms.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'sms/static') ] # Media folder MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' # Django Rest Framework Authentication REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication', ] } |
In this module which is the module for setting up the installed apps, database and etc.
- The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “sms” method.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from django.contrib import admin from django.urls import path, include from . import views from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('', views.index, name='home'), path('accounts/', include('accounts.urls')), path('students/', include('students.urls')), path('teachers/', include('teachers.urls')), path('api/', include('api.urls')), ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
In this module which is the URL configuration module under sms method.
- The Code Given Below Is For The “views.py” Module – you can add the following code below into your “views.py” under the “sms” method.
1 2 3 4 5 6 |
from django.shortcuts import render from django.contrib.auth.decorators import login_required @login_required def index(request): return render(request, "home.html") |
In this module which is the index module of the sms method.
The List Of Module Given Below Are Under The “students” Method
- The Code Given Below Is For The “views.py” Module – you can add the following code below into your “views.py” under the “students” method.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
from django.shortcuts import render, get_object_or_404, redirect from .models import * from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.contrib import messages from .forms import CreateStudent # Create your views here. def student_list(request): students = StudentInfo.objects.all() paginator = Paginator(students, 1) page = request.GET.get('page') paged_students = paginator.get_page(page) context = { "students": paged_students } return render(request, "students/student_list.html", context) def single_student(request, student_id): single_student = get_object_or_404(StudentInfo, pk=student_id) context = { "single_student": single_student } return render(request, "students/student_details.html", context) def student_regi(request): if request.method == "POST": forms = CreateStudent(request.POST) if forms.is_valid(): forms.save() messages.success(request, "Student Registration Successfully!") return redirect("student_list") else: forms = CreateStudent() context = { "forms": forms } return render(request, "students/registration.html", context) def edit_student(request, pk): student_edit = StudentInfo.objects.get(id=pk) edit_forms = CreateStudent(instance=student_edit) if request.method == "POST": edit_forms = CreateStudent(request.POST, instance=student_edit) if edit_forms.is_valid(): edit_forms.save() messages.success(request, "Edit Student Info Successfully!") return redirect("student_list") context = { "edit_forms": edit_forms } return render(request, "students/edit_student.html", context) def delete_student(request, student_id): student_delete = StudentInfo.objects.get(id=student_id) student_delete.delete() messages.success(request, "Delete Student Info Successfully") return redirect("student_list") def attendance_count(request): class_name = request.GET.get("class_name", None) if class_name: student_list = StudentInfo.objects.filter(class_type__class_short_form=class_name) context = {"student_list": student_list} else: context = {} return render(request, "students/attendance_count.html", context) |
In this module which is the index module of the students method.
- The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “students” method.
1 2 3 4 5 6 7 8 9 10 11 |
from django.urls import path from . import views urlpatterns = [ path('allstudents/', views.student_list, name='student_list'), path('<int:student_id>/', views.single_student, name='single_student'), path('registration/', views.student_regi, name='student_regi'), path('edit/<int:pk>', views.edit_student, name='edit_student'), path('delete/<int:student_id>', views.delete_student, name='delete_student'), path('attendance/count', views.attendance_count, name='attendance_count'), ] |
In this module which is the URL configuration module under students method.
- The Code Given Below Is For The “models.py” Module – you can add the following code below into your “models.py” under the “students” method.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
from django.db import models # Create your models here. class StudentClassInfo(models.Model): class_name = models.CharField(max_length=20) class_short_form = models.CharField(max_length=10) def __str__(self): return self.class_name class StudentSectionInfo(models.Model): section_name = models.CharField(max_length=20) def __str__(self): return self.section_name class StudentShiftInfo(models.Model): shift_name = models.CharField(max_length=100) def __str__(self): return self.shift_name class StudentInfo(models.Model): academic_year = models.CharField(max_length=100) admission_date = models.DateField() admission_id = models.CharField(max_length=50, unique=True) name = models.CharField(max_length=100) age = models.IntegerField() gender_choice = ( ("male", "Male"), ("Female", "Female"), ) gender = models.CharField(choices=gender_choice, max_length=10) class_type = models.ForeignKey(StudentClassInfo, on_delete=models.CASCADE) section_type = models.ForeignKey(StudentSectionInfo, on_delete=models.CASCADE) shift_type = models.ForeignKey(StudentShiftInfo, on_delete=models.CASCADE) student_img = models.ImageField(upload_to='photos/%Y/%m/%d/') fathers_name = models.CharField(max_length=100) fathers_img = models.ImageField(upload_to='photos/%Y/%m/%d/') fathers_nid = models.IntegerField(unique=True) fathers_number = models.IntegerField(unique=True) mothers_name = models.CharField(max_length=100) mothers_img = models.ImageField(upload_to='photos/%Y/%m/%d/') mothers_nid = models.IntegerField(unique=True) mothers_number = models.IntegerField() class Meta: unique_together = ["admission_id", "class_type"] def __str__(self): return self.name class AttendanceManager(models.Manager): def create_attendance(self, student_class, student_id): student_obj = StudentInfo.objects.get( class_type__class_short_form=student_class, admission_id=student_id ) attendance_obj = Attendance.objects.create(student=student_obj, status=1) return attendance_obj class Attendance(models.Model): student = models.ForeignKey(StudentInfo, on_delete=models.CASCADE) date = models.DateField(auto_now_add=True) status = models.IntegerField(default=0) objects = AttendanceManager() class Meta: unique_together = ['student', 'date'] def __str__(self): return self.student.admission_id |
In this module which you can found classes to be call under students method.
- The Code Given Below Is For The “forms.py” Module – you can add the following code below into your “forms.py” under the “students” method.
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 |
from .models import StudentInfo class CreateStudent(forms.ModelForm): class Meta: model = StudentInfo exclude = ("student_img", "fathers_img", "mothers_img", ) widgets = { 'academic_year': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Academic Year'}), 'admission_date': forms.DateInput(attrs={'class': 'form-control', 'placeholder': 'Admission Date'}), 'admission_id': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Admission ID'}), 'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Name'}), 'age': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Age'}), 'gender': forms.Select(attrs={'class': 'form-control'}), 'class_type': forms.Select(attrs={'class': 'form-control'}), 'section_type': forms.Select(attrs={'class': 'form-control'}), 'shift_type': forms.Select(attrs={'class': 'form-control'}), 'fathers_name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Fathers Name'}), 'fathers_nid': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Fathers ID'}), 'fathers_number': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Fathers Number'}), 'mothers_name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Mothers Name'}), 'mothers_nid': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Mothers ID'}), 'mothers_number': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Mothers Number'}), } |
In this module which is the students form under students method.
The List Of Module Given Below Are Under The “teachers” Method
- The Code Given Below Is For The “views.py” Module – you can add the following code below into your “views.py” under the “teachers” method.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
from django.shortcuts import render, get_object_or_404, redirect from .models import TeacherInfo from .forms import CreateTeacher from django.contrib import messages from django.core.paginator import Paginator # Create your views here. def teacher_list(request): teachers = TeacherInfo.objects.all() paginator = Paginator(teachers, 1) page = request.GET.get('page') paged_teachers = paginator.get_page(page) context = { "teachers": paged_teachers } return render(request, "teachers/teacher_list.html", context) def single_teacher(request, teacher_id): single_teacher = get_object_or_404(TeacherInfo, pk=teacher_id) context = { "single_teacher": single_teacher } return render(request, "teachers/single_teacher.html", context) def create_teacher(request): if request.method == "POST": forms = CreateTeacher(request.POST, request.FILES or None) if forms.is_valid(): forms.save() messages.success(request, "Teacher Registration Successfully!") return redirect("teacher_list") else: forms = CreateTeacher() context = { "forms": forms } return render(request, "teachers/create_teacher.html", context) def edit_teacher(request, pk): teacher_edit = TeacherInfo.objects.get(id=pk) edit_teacher_forms = CreateTeacher(instance=teacher_edit) if request.method == "POST": edit_teacher_forms = CreateTeacher(request.POST, request.FILES or None, instance=teacher_edit) if edit_teacher_forms.is_valid(): edit_teacher_forms.save() messages.success(request, "Edit Teacher Info Successfully!") return redirect("teacher_list") context = { "edit_teacher_forms": edit_teacher_forms } return render(request, "teachers/edit_teacher.html", context) def delete_teacher(request, teacher_id): teacher_delete = TeacherInfo.objects.get(id=teacher_id) teacher_delete.delete() messages.success(request, "Delete Teacher Info Successfully") return redirect("teacher_list") |
In this module which is the index module of the teachers method.
- The Code Given Below Is For The “urls.py” Module – you can add the following code below into your “urls.py” under the “teachers” method.
1 2 3 4 5 6 7 8 9 10 |
from django.urls import path from . import views urlpatterns = [ path('allteachers/', views.teacher_list, name='teacher_list'), path('<int:teacher_id>/', views.single_teacher, name='single_teacher'), path('registration/', views.create_teacher, name='create_teacher'), path('edit/<int:pk>', views.edit_teacher, name='edit_teacher'), path('delete/<int:teacher_id>', views.delete_teacher, name='delete_teacher'), ] |
In this module which is the URL configuration module under teachers method.
- The Code Given Below Is For The “models.py” Module – you can add the following code below into your “models.py” under the “teachers” method.
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 26 27 28 29 30 31 32 33 |
from django.db import models # Create your models here. class TeacherDeptInfo(models.Model): dept_name = models.CharField(max_length=50) def __str__(self): return self.dept_name class TeacherSubInfo(models.Model): sub_name = models.CharField(max_length=50) def __str__(self): return self.sub_name class TeacherInfo(models.Model): name = models.CharField(max_length=100) email = models.EmailField(unique=True) age = models.IntegerField() gender_choice = ( ("male", "Male"), ("Female", "Female"), ) gender = models.CharField(choices=gender_choice, max_length=10) teacher_img = models.ImageField(upload_to='photos/%Y/%m/%d/') passing_year = models.CharField(max_length=100) joining_date = models.DateField() dept_type = models.ForeignKey(TeacherDeptInfo, on_delete=models.CASCADE) sub_type = models.ForeignKey(TeacherSubInfo, on_delete=models.CASCADE) salary = models.IntegerField() def __str__(self): return self.name |
In this module which you can found classes to be call under students method.
- The Code Given Below Is For The “forms.py” Module – you can add the following code below into your “forms.py” under the “teachers” method.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from django import forms from .models import TeacherInfo class CreateTeacher(forms.ModelForm): class Meta: model = TeacherInfo fields = "__all__" widgets = { 'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Name'}), 'email': forms.EmailInput(attrs={'class': 'form-control', 'placeholder': 'Email'}), 'age': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Age'}), 'gender': forms.Select(attrs={'class': 'form-control'}), 'teacher_img': forms.FileInput(attrs={'class': 'form-control'}), 'passing_year': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Passing Year'}), 'joining_date': forms.DateInput(attrs={'class': 'form-control', 'placeholder': 'Joining Date'}), 'admission_id': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Admission ID'}), 'dept_type': forms.Select(attrs={'class': 'form-control'}), 'sub_type': forms.Select(attrs={'class': 'form-control'}), 'salary': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Salary'}), } |
In this module which is the students form under teachers method.
This Will Be The Output






I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.
Run Quick Virus Scan for secure Download
Run Quick Scan for secure DownloadDownloadable Source Code Below.
Anyway, if you want to level up your programming knowledge, especially python, try this new article I’ve made for you Best Python Projects with source code for Beginners. But If you’re going to focus on web development using Django, you can download here from our list of Best Django Projects with source code based on real-world projects.
How To Run The School Management System Project In Django?
1.) python manage.py runserver
Summary
The system is built fully in Django Framework in back-end and HTML, CSS in front-end. It has full-featured user interface with all the functionalities
This Article is the way to enhance and develop our skills and logic ideas which is important in practicing the python programming language which is most well known and most usable programming language in many company.
Related article below
- How To Make A Point Of Sale System In Python
- Best Python Projects for Beginners
- Python MySQL Connection: Simple Python Step by Step Guide
- Python PIP Command Set-up / Fix: Step by Step Guide
- Random Password Generator in Python Projects With Source Code 2020
- Python Range Function|Range in Python Explained with Examples 2020
Inquiries
If you have any questions or suggestions about School Management System Project In Django, please feel free to leave a comment below.