Upload 35 files
Browse files- .env +5 -0
- Dockerfile +6 -6
- ExamscheduleViewer/__pycache__/settings.cpython-312.pyc +0 -0
- ExamscheduleViewer/settings.py +139 -129
- db.sqlite3 +1 -1
- genrateExamSchedule/__pycache__/urls.cpython-312.pyc +0 -0
- genrateExamSchedule/__pycache__/views.cpython-312.pyc +0 -0
- genrateExamSchedule/urls.py +1 -0
- genrateExamSchedule/views.py +7 -0
- requirements.txt +0 -0
- templates/index.html +1 -0
.env
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SUPABASE_DB_NAME=postgres
|
| 2 |
+
SUPABASE_DB_USER=postgres.cbvtwdehqojiviwfcsns
|
| 3 |
+
SUPABASE_DB_PASSWORD=DAU@202499907
|
| 4 |
+
SUPABASE_DB_HOST=aws-0-ap-south-1.pooler.supabase.com
|
| 5 |
+
SUPABASE_DB_PORT=6543
|
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
FROM python:3.9
|
| 2 |
-
WORKDIR /usr/src/manage
|
| 3 |
-
COPY requirements.txt ./
|
| 4 |
-
RUN pip install -r requirements.txt
|
| 5 |
-
COPY . .
|
| 6 |
-
EXPOSE 7860
|
| 7 |
CMD ["python","./manage.py","runserver","0.0.0.0:7860"]
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
WORKDIR /usr/src/manage
|
| 3 |
+
COPY requirements.txt ./
|
| 4 |
+
RUN pip install -r requirements.txt
|
| 5 |
+
COPY . .
|
| 6 |
+
EXPOSE 7860
|
| 7 |
CMD ["python","./manage.py","runserver","0.0.0.0:7860"]
|
ExamscheduleViewer/__pycache__/settings.cpython-312.pyc
CHANGED
|
Binary files a/ExamscheduleViewer/__pycache__/settings.cpython-312.pyc and b/ExamscheduleViewer/__pycache__/settings.cpython-312.pyc differ
|
|
|
ExamscheduleViewer/settings.py
CHANGED
|
@@ -1,129 +1,139 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Django settings for ExamscheduleViewer project.
|
| 3 |
-
|
| 4 |
-
Generated by 'django-admin startproject' using Django 5.0.4.
|
| 5 |
-
|
| 6 |
-
For more information on this file, see
|
| 7 |
-
https://docs.djangoproject.com/en/5.0/topics/settings/
|
| 8 |
-
|
| 9 |
-
For the full list of settings and their values, see
|
| 10 |
-
https://docs.djangoproject.com/en/5.0/ref/settings/
|
| 11 |
-
"""
|
| 12 |
-
|
| 13 |
-
from pathlib import Path
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# SECURITY WARNING:
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
'django.contrib.
|
| 40 |
-
'django.contrib.
|
| 41 |
-
'django.contrib.
|
| 42 |
-
'django.contrib.
|
| 43 |
-
'
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
'django.middleware.
|
| 50 |
-
'django.
|
| 51 |
-
'django.
|
| 52 |
-
'django.
|
| 53 |
-
'django.
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
'
|
| 63 |
-
'
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
'django.
|
| 68 |
-
'django.
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Django settings for ExamscheduleViewer project.
|
| 3 |
+
|
| 4 |
+
Generated by 'django-admin startproject' using Django 5.0.4.
|
| 5 |
+
|
| 6 |
+
For more information on this file, see
|
| 7 |
+
https://docs.djangoproject.com/en/5.0/topics/settings/
|
| 8 |
+
|
| 9 |
+
For the full list of settings and their values, see
|
| 10 |
+
https://docs.djangoproject.com/en/5.0/ref/settings/
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from dotenv import load_dotenv
|
| 15 |
+
import os
|
| 16 |
+
load_dotenv()
|
| 17 |
+
|
| 18 |
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
| 19 |
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# Quick-start development settings - unsuitable for production
|
| 23 |
+
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
| 24 |
+
|
| 25 |
+
# SECURITY WARNING: keep the secret key used in production secret!
|
| 26 |
+
SECRET_KEY = 'django-insecure-**@-tuvqyk^ildsh4(g7t^dqa5-9t$n)i6a3+k7wo$9as-r+@d'
|
| 27 |
+
|
| 28 |
+
# SECURITY WARNING: don't run with debug turned on in production!
|
| 29 |
+
DEBUG = True
|
| 30 |
+
|
| 31 |
+
ALLOWED_HOSTS = ["*"]
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Application definition
|
| 35 |
+
|
| 36 |
+
INSTALLED_APPS = [
|
| 37 |
+
'django.contrib.admin',
|
| 38 |
+
'django.contrib.auth',
|
| 39 |
+
'django.contrib.contenttypes',
|
| 40 |
+
'django.contrib.sessions',
|
| 41 |
+
'django.contrib.messages',
|
| 42 |
+
'django.contrib.staticfiles',
|
| 43 |
+
'genrateExamSchedule',
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
MIDDLEWARE = [
|
| 47 |
+
'django.middleware.security.SecurityMiddleware',
|
| 48 |
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
| 49 |
+
'django.middleware.common.CommonMiddleware',
|
| 50 |
+
'django.middleware.csrf.CsrfViewMiddleware',
|
| 51 |
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
| 52 |
+
'django.contrib.messages.middleware.MessageMiddleware',
|
| 53 |
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
ROOT_URLCONF = 'ExamscheduleViewer.urls'
|
| 57 |
+
|
| 58 |
+
TEMPLATES = [
|
| 59 |
+
{
|
| 60 |
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
| 61 |
+
'DIRS': ['templates'],
|
| 62 |
+
'APP_DIRS': True,
|
| 63 |
+
'OPTIONS': {
|
| 64 |
+
'context_processors': [
|
| 65 |
+
'django.template.context_processors.debug',
|
| 66 |
+
'django.template.context_processors.request',
|
| 67 |
+
'django.contrib.auth.context_processors.auth',
|
| 68 |
+
'django.contrib.messages.context_processors.messages',
|
| 69 |
+
|
| 70 |
+
],
|
| 71 |
+
},
|
| 72 |
+
},
|
| 73 |
+
]
|
| 74 |
+
|
| 75 |
+
WSGI_APPLICATION = 'ExamscheduleViewer.wsgi.application'
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
# Database
|
| 79 |
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
| 80 |
+
|
| 81 |
+
DATABASES = {
|
| 82 |
+
# 'default': {
|
| 83 |
+
# 'ENGINE': 'django.db.backends.sqlite3',
|
| 84 |
+
# 'NAME': BASE_DIR / 'db.sqlite3',
|
| 85 |
+
# }
|
| 86 |
+
'default': {
|
| 87 |
+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
| 88 |
+
'NAME': os.environ.get('SUPABASE_DB_NAME'),
|
| 89 |
+
'USER': os.environ.get('SUPABASE_DB_USER'),
|
| 90 |
+
'PASSWORD': os.environ.get('SUPABASE_DB_PASSWORD'),
|
| 91 |
+
'HOST': os.environ.get('SUPABASE_DB_HOST'),
|
| 92 |
+
'PORT': os.environ.get('SUPABASE_DB_PORT'),
|
| 93 |
+
'OPTIONS': {
|
| 94 |
+
'sslmode': 'require', # Enforce SSL connection (recommended for Supabase)
|
| 95 |
+
},
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
# Password validation
|
| 101 |
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
|
| 102 |
+
|
| 103 |
+
AUTH_PASSWORD_VALIDATORS = [
|
| 104 |
+
{
|
| 105 |
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
| 115 |
+
},
|
| 116 |
+
]
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
# Internationalization
|
| 120 |
+
# https://docs.djangoproject.com/en/5.0/topics/i18n/
|
| 121 |
+
|
| 122 |
+
LANGUAGE_CODE = 'en-us'
|
| 123 |
+
|
| 124 |
+
TIME_ZONE = 'UTC'
|
| 125 |
+
|
| 126 |
+
USE_I18N = True
|
| 127 |
+
|
| 128 |
+
USE_TZ = True
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
# Static files (CSS, JavaScript, Images)
|
| 132 |
+
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
| 133 |
+
|
| 134 |
+
STATIC_URL = 'static/'
|
| 135 |
+
|
| 136 |
+
# Default primary key field type
|
| 137 |
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
|
| 138 |
+
|
| 139 |
+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
db.sqlite3
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 466944
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:05d1cebfcabcd9037354bb7e29c68769d563cf19f29b83be022fe8029ed22ac1
|
| 3 |
size 466944
|
genrateExamSchedule/__pycache__/urls.cpython-312.pyc
CHANGED
|
Binary files a/genrateExamSchedule/__pycache__/urls.cpython-312.pyc and b/genrateExamSchedule/__pycache__/urls.cpython-312.pyc differ
|
|
|
genrateExamSchedule/__pycache__/views.cpython-312.pyc
CHANGED
|
Binary files a/genrateExamSchedule/__pycache__/views.cpython-312.pyc and b/genrateExamSchedule/__pycache__/views.cpython-312.pyc differ
|
|
|
genrateExamSchedule/urls.py
CHANGED
|
@@ -12,3 +12,4 @@ urlpatterns = [
|
|
| 12 |
path('view_schedule/', views.view_schedule, name='view_schedule'),
|
| 13 |
|
| 14 |
]
|
|
|
|
|
|
| 12 |
path('view_schedule/', views.view_schedule, name='view_schedule'),
|
| 13 |
|
| 14 |
]
|
| 15 |
+
|
genrateExamSchedule/views.py
CHANGED
|
@@ -15,6 +15,7 @@ from django.contrib.auth import login, authenticate
|
|
| 15 |
from django.contrib.auth.models import User
|
| 16 |
|
| 17 |
|
|
|
|
| 18 |
def login_view(request):
|
| 19 |
if request.method == 'POST':
|
| 20 |
username = request.POST.get('username')
|
|
@@ -325,12 +326,16 @@ class ExamSeatingPlanGenerator:
|
|
| 325 |
|
| 326 |
|
| 327 |
def index(request):
|
|
|
|
|
|
|
| 328 |
if request.session['is_login'] == False:
|
| 329 |
return redirect('login_view')
|
| 330 |
else:
|
| 331 |
return render(request, 'index.html')
|
| 332 |
# @login_required('login')
|
| 333 |
def generate_schedule(request):
|
|
|
|
|
|
|
| 334 |
if request.session['is_login'] == False:
|
| 335 |
return redirect('login_view')
|
| 336 |
else:
|
|
@@ -358,6 +363,8 @@ def generate_schedule(request):
|
|
| 358 |
|
| 359 |
# @login_required('login')
|
| 360 |
def upload_schedule(request):
|
|
|
|
|
|
|
| 361 |
if request.session['is_login'] == False:
|
| 362 |
return redirect('login_view')
|
| 363 |
else:
|
|
|
|
| 15 |
from django.contrib.auth.models import User
|
| 16 |
|
| 17 |
|
| 18 |
+
|
| 19 |
def login_view(request):
|
| 20 |
if request.method == 'POST':
|
| 21 |
username = request.POST.get('username')
|
|
|
|
| 326 |
|
| 327 |
|
| 328 |
def index(request):
|
| 329 |
+
if 'is_login' not in request.session:
|
| 330 |
+
return redirect('login_view')
|
| 331 |
if request.session['is_login'] == False:
|
| 332 |
return redirect('login_view')
|
| 333 |
else:
|
| 334 |
return render(request, 'index.html')
|
| 335 |
# @login_required('login')
|
| 336 |
def generate_schedule(request):
|
| 337 |
+
if 'is_login' not in request.session:
|
| 338 |
+
return redirect('login_view')
|
| 339 |
if request.session['is_login'] == False:
|
| 340 |
return redirect('login_view')
|
| 341 |
else:
|
|
|
|
| 363 |
|
| 364 |
# @login_required('login')
|
| 365 |
def upload_schedule(request):
|
| 366 |
+
if 'is_login' not in request.session:
|
| 367 |
+
return redirect('login_view')
|
| 368 |
if request.session['is_login'] == False:
|
| 369 |
return redirect('login_view')
|
| 370 |
else:
|
requirements.txt
CHANGED
|
Binary files a/requirements.txt and b/requirements.txt differ
|
|
|
templates/index.html
CHANGED
|
@@ -61,6 +61,7 @@
|
|
| 61 |
<body>
|
| 62 |
<nav>
|
| 63 |
<a href="{% url 'index' %}">Home</a> |
|
|
|
|
| 64 |
<a href="{% url 'view_schedule' %}">View Schedule</a> |
|
| 65 |
<a href="{% url 'logout_view' %}">Logout</a>
|
| 66 |
</nav>
|
|
|
|
| 61 |
<body>
|
| 62 |
<nav>
|
| 63 |
<a href="{% url 'index' %}">Home</a> |
|
| 64 |
+
<a href="{% url 'upload_schedule' %}">Upload Seating Plan</a> |
|
| 65 |
<a href="{% url 'view_schedule' %}">View Schedule</a> |
|
| 66 |
<a href="{% url 'logout_view' %}">Logout</a>
|
| 67 |
</nav>
|