JaivinBarot commited on
Commit
5d26c45
·
verified ·
1 Parent(s): 3be8743

Upload 35 files

Browse files
.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
- # Build paths inside the project like this: BASE_DIR / 'subdir'.
16
- BASE_DIR = Path(__file__).resolve().parent.parent
17
-
18
-
19
- # Quick-start development settings - unsuitable for production
20
- # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
21
-
22
- # SECURITY WARNING: keep the secret key used in production secret!
23
- SECRET_KEY = 'django-insecure-**@-tuvqyk^ildsh4(g7t^dqa5-9t$n)i6a3+k7wo$9as-r+@d'
24
-
25
- # SECURITY WARNING: don't run with debug turned on in production!
26
- DEBUG = True
27
-
28
- ALLOWED_HOSTS = ["*"]
29
- CSRF_TRUSTED_ORIGINS = [
30
- 'https://dau-main-exams.hf.space',
31
- # Add any other trusted origins here, e.g., your local development server
32
- 'http://127.0.0.1:8000',
33
- 'http://localhost:8000',
34
- ]
35
-
36
- # Application definition
37
-
38
- INSTALLED_APPS = [
39
- 'django.contrib.admin',
40
- 'django.contrib.auth',
41
- 'django.contrib.contenttypes',
42
- 'django.contrib.sessions',
43
- 'django.contrib.messages',
44
- 'django.contrib.staticfiles',
45
- 'genrateExamSchedule',
46
- ]
47
-
48
- MIDDLEWARE = [
49
- 'django.middleware.security.SecurityMiddleware',
50
- 'django.contrib.sessions.middleware.SessionMiddleware',
51
- 'django.middleware.common.CommonMiddleware',
52
- 'django.middleware.csrf.CsrfViewMiddleware',
53
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
54
- 'django.contrib.messages.middleware.MessageMiddleware',
55
- 'django.middleware.clickjacking.XFrameOptionsMiddleware',
56
- ]
57
-
58
- ROOT_URLCONF = 'ExamscheduleViewer.urls'
59
-
60
- TEMPLATES = [
61
- {
62
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
63
- 'DIRS': ['templates'],
64
- 'APP_DIRS': True,
65
- 'OPTIONS': {
66
- 'context_processors': [
67
- 'django.template.context_processors.debug',
68
- 'django.template.context_processors.request',
69
- 'django.contrib.auth.context_processors.auth',
70
- 'django.contrib.messages.context_processors.messages',
71
- ],
72
- },
73
- },
74
- ]
75
-
76
- WSGI_APPLICATION = 'ExamscheduleViewer.wsgi.application'
77
-
78
-
79
- # Database
80
- # https://docs.djangoproject.com/en/5.0/ref/settings/#databases
81
-
82
- DATABASES = {
83
- 'default': {
84
- 'ENGINE': 'django.db.backends.sqlite3',
85
- 'NAME': BASE_DIR / 'db.sqlite3',
86
- }
87
- }
88
-
89
-
90
- # Password validation
91
- # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
92
-
93
- AUTH_PASSWORD_VALIDATORS = [
94
- {
95
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
96
- },
97
- {
98
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
99
- },
100
- {
101
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
102
- },
103
- {
104
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
105
- },
106
- ]
107
-
108
-
109
- # Internationalization
110
- # https://docs.djangoproject.com/en/5.0/topics/i18n/
111
-
112
- LANGUAGE_CODE = 'en-us'
113
-
114
- TIME_ZONE = 'UTC'
115
-
116
- USE_I18N = True
117
-
118
- USE_TZ = True
119
-
120
-
121
- # Static files (CSS, JavaScript, Images)
122
- # https://docs.djangoproject.com/en/5.0/howto/static-files/
123
-
124
- STATIC_URL = 'static/'
125
-
126
- # Default primary key field type
127
- # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
128
-
129
- DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 
 
 
 
 
 
 
 
 
 
 
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:e9c9c2909f8ec33b1ba647b80aab25ee6e74ddb8f7d38e4dc5a011a168084dd3
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>