.elasticbeanstalk/*
!.elasticbeanstalk/.cfg.yml
!.elasticbeanstalk/.global.yml
*.pyc
Empty file added0
Attendance_System/init.py
Empty file.
153 changes: 153 additions & 0 deletions153
Attendance_System/settings.py
@@ -0,0 +1,153 @@
"""
Django settings for Attendance_System project.
Generated by 'django-admin startproject' using Django 2.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))
SECRET_KEY = '8+%^jq#ilmh)r=-c6b1^br5j1scqu%keo31$jv=$wrv7@+82mu'
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'api_v1', ]
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', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ]
ROOT_URLCONF = 'Attendance_System.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 = 'Attendance_System.wsgi.application'
''' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } '''
if 'RDS_HOSTNAME' in os.environ: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': os.environ['RDS_DB_NAME'], 'USER': os.environ['RDS_USERNAME'], 'PASSWORD': os.environ['RDS_PASSWORD'], 'HOST': os.environ['RDS_HOSTNAME'], 'PORT': os.environ['RDS_PORT'], } }
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', }, ]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
REST_FRAMEWORK={ "DATETIME_FORMAT": "%Y-%m-%d %H:%M:%S UTC", "DEFAULT_AUTHENTICATION_CLASSES": ( 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.TokenAuthentication', ), }
STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR,'static')
#LOGIN/LOGOUT URL LOGIN_REDIRECT_URL = '/home' LOGOUT_REDIRECT_URL = '/accounts/login'
#CORS CORS_ORIGIN_ALLOW_ALL = True
27 changes: 27 additions & 0 deletions27
Attendance_System/urls.py
@@ -0,0 +1,27 @@
"""Attendance_System URL Configuration
The urlpatterns
list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include
from django.contrib.auth.views import LogoutView
from . import settings
urlpatterns = [
path('admin/', admin.site.urls),
url(r"^",include("api_v1.urls")),
path('accounts/', include('django.contrib.auth.urls')), # new
url(r'^logout/$', LogoutView.as_view(), {'next_page': settings.LOGOUT_REDIRECT_URL}, name='logout'),
]
16 changes: 16 additions & 0 deletions16
Attendance_System/wsgi.py
@@ -0,0 +1,16 @@
"""
WSGI config for Attendance_System project.
It exposes the WSGI callable as a module-level variable named application
.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Attendance_System.settings')
application = get_wsgi_application()
1 change: 1 addition & 0 deletions1
api_v1/init.py
@@ -0,0 +1 @@
default_app_config = "api_v1.apps.ApiV1Config"
8 changes: 8 additions & 0 deletions8
api_v1/admin.py
@@ -0,0 +1,8 @@
from django.contrib import admin
from api_v1.models import *
admin.site.register(student)
admin.site.register(subjects)
admin.site.register(attendance)
admin.site.register(studentSubject)
8 changes: 8 additions & 0 deletions8
api_v1/apps.py
@@ -0,0 +1,8 @@
from django.apps import AppConfig
class ApiV1Config(AppConfig): name = 'api_v1'
def ready(self):
import api_v1.signals
85 changes: 85 additions & 0 deletions85
api_v1/migrations/0001_initial.py
@@ -0,0 +1,85 @@
import api_v1.models from django.db import migrations, models import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='attendance',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('recordAdded', models.DateTimeField(auto_now_add=True)),
('recordModified', models.DateTimeField(auto_now=True)),
('lectureDate', models.DateTimeField()),
('status', models.CharField(max_length=20)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='student',
fields=[
('recordAdded', models.DateTimeField(auto_now_add=True)),
('recordModified', models.DateTimeField(auto_now=True)),
('studentId', models.UUIDField(default=api_v1.models.generateUUID, editable=False, primary_key=True, serialize=False)),
('firstName', models.CharField(max_length=200)),
('lastName', models.CharField(max_length=200)),
('address', models.CharField(max_length=200)),
('mobileNo', models.CharField(max_length=15)),
('department', models.CharField(max_length=100, unique=True)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='studentSubject',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('recordAdded', models.DateTimeField(auto_now_add=True)),
('recordModified', models.DateTimeField(auto_now=True)),
('studentId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_v1.student')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='subjects',
fields=[
('recordAdded', models.DateTimeField(auto_now_add=True)),
('recordModified', models.DateTimeField(auto_now=True)),
('subjectCode', models.AutoField(primary_key=True, serialize=False)),
('title', models.CharField(max_length=200)),
('department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_v1.student', to_field='department')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='studentsubject',
name='subjectCode',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_v1.subjects'),
),
migrations.AddField(
model_name='attendance',
name='studentId',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_v1.student'),
),
migrations.AddField(
model_name='attendance',
name='subjectCode',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_v1.subjects'),
),
]
17 changes: 17 additions & 0 deletions17
api_v1/migrations/0002_remove_subjects_department.py
@@ -0,0 +1,17 @@
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api_v1', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='subjects',
name='department',
),
]
18 changes: 18 additions & 0 deletions18
api_v1/migrations/0003_auto_20200913_1441.py
@@ -0,0 +1,18 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_v1', '0002_remove_subjects_department'),
]
operations = [
migrations.AlterField(
model_name='student',
name='department',
field=models.CharField(max_length=100),
),
]
19 changes: 19 additions & 0 deletions19
api_v1/migrations/0004_auto_20200915_1012.py
@@ -0,0 +1,19 @@
import api_v1.models from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_v1', '0003_auto_20200913_1441'),
]
operations = [
migrations.AlterField(
model_name='student',
name='studentId',
field=models.CharField(default=api_v1.models.generateUUID, editable=False, max_length=200, primary_key=True, serialize=False),
),
]
18 changes: 18 additions & 0 deletions18
api_v1/migrations/0005_student_email.py
@@ -0,0 +1,18 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_v1', '0004_auto_20200915_1012'),
]
operations = [
migrations.AddField(
model_name='student',
name='email',
field=models.CharField(default='Not Available', max_length=200),
),
]