huge update
This commit is contained in:
1 parent
8072284990
commit
f2c72885a6
123 files changed
+25119
-4984
No files matched your search
@@ -25,12 +25,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY")
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||
DEBUG = os.getenv("DJANGO_DEBUG", "False") == "True"
|
||||
|
||||
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '*').split(',')
|
||||
ALLOWED_HOSTS = os.getenv("DJANGO_ALLOWED_HOSTS", "*").split(",")
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -56,13 +56,21 @@ MIDDLEWARE = [
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
"app.middleware.HTTP505Middleware", # Custom middleware for handling 505 errors
|
||||
]
|
||||
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
"app.backends.MultiModelBackend",
|
||||
"django.contrib.auth.backends.ModelBackend",
|
||||
]
|
||||
REST_FRAMEWORK = {"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.AllowAny"]}
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.AllowAny"],
|
||||
"DEFAULT_RENDERER_CLASSES": [
|
||||
"rest_framework.renderers.JSONRenderer",
|
||||
],
|
||||
}
|
||||
|
||||
ROOT_URLCONF = "student_management_system.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
@@ -156,27 +164,40 @@ JAZZMIN_SETTINGS = JAZZMIN_SETTINGS
|
||||
JAZZMIN_UI_TWEAKS = JAZZMIN_UI_TWEAKS
|
||||
|
||||
# Login redirect URL
|
||||
LOGIN_REDIRECT_URL = '/app/dashboard/'
|
||||
LOGIN_URL = '/login/'
|
||||
LOGIN_REDIRECT_URL = "/app/dashboard/"
|
||||
LOGIN_URL = "/login/"
|
||||
|
||||
# Email Configuration
|
||||
EMAIL_BACKEND = os.getenv('EMAIL_BACKEND', 'django.core.mail.backends.console.EmailBackend')
|
||||
DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'noreply@studentmanagementsystem.com')
|
||||
EMAIL_BACKEND = os.getenv(
|
||||
"EMAIL_BACKEND", "django.core.mail.backends.console.EmailBackend"
|
||||
)
|
||||
DEFAULT_FROM_EMAIL = os.getenv(
|
||||
"DEFAULT_FROM_EMAIL", "noreply@studentmanagementsystem.com"
|
||||
)
|
||||
|
||||
# Cache configuration for OTP storage
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': os.getenv('CACHE_LOCATION', 'unique-snowflake'),
|
||||
"default": {
|
||||
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
|
||||
"LOCATION": os.getenv("CACHE_LOCATION", "unique-snowflake"),
|
||||
}
|
||||
}
|
||||
|
||||
# SMS API configuration
|
||||
SMS_API_KEY = os.getenv('SMS_API_KEY', '')
|
||||
SMS_SENDER_ID = os.getenv('SMS_SENDER_ID', 'SMSSYS')
|
||||
SMS_API_KEY = os.getenv("SMS_API_KEY", "")
|
||||
SMS_SENDER_ID = os.getenv("SMS_SENDER_ID", "SMSSYS")
|
||||
|
||||
# CSRF settings
|
||||
# CSRF_TRUSTED_ORIGINS = [
|
||||
# "https://*.ngrok-free.app",
|
||||
# "https://*.ngrok.io"
|
||||
# ]
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
"https://*.ngrok-free.app",
|
||||
"https://*.ngrok.io"
|
||||
]
|
||||
# Firebase settings
|
||||
FIREBASE_API_KEY = os.getenv("FIREBASE_API_KEY", "")
|
||||
FIREBASE_AUTH_DOMAIN = os.getenv("FIREBASE_AUTH_DOMAIN", "")
|
||||
FIREBASE_PROJECT_ID = os.getenv("FIREBASE_PROJECT_ID", "")
|
||||
FIREBASE_STORAGE_BUCKET = os.getenv("FIREBASE_STORAGE_BUCKET", "")
|
||||
FIREBASE_MESSAGING_SENDER_ID = os.getenv("FIREBASE_MESSAGING_SENDER_ID", "")
|
||||
FIREBASE_APP_ID = os.getenv("FIREBASE_APP_ID", "")
|
||||
FIREBASE_MEASUREMENT_ID = os.getenv("FIREBASE_MEASUREMENT_ID", "")
|
||||
@@ -27,24 +27,29 @@ from app import auth
|
||||
|
||||
# Main URL patterns for the project
|
||||
urlpatterns = [
|
||||
# Application URLs ------------------------------------------------
|
||||
path("app/", include("app.urls")),
|
||||
path("admin/", custom_admin_site.urls),
|
||||
|
||||
# Root URL redirects to dashboard
|
||||
# Root Redirect --------------------------------------------------
|
||||
path("", RedirectView.as_view(url="/app/dashboard/", permanent=False)),
|
||||
|
||||
# Authentication URLs
|
||||
path('login/', auth_views.LoginView.as_view(template_name='login/login.html'), name='login'),
|
||||
path('logout/', auth_views.LogoutView.as_view(next_page='/login/'), name='logout'),
|
||||
|
||||
# Password reset URLs
|
||||
path('password-reset/', auth.reset_password_options, name='password_reset'),
|
||||
|
||||
# Firebase service worker URL
|
||||
path('firebase-messaging-sw.js', views.serve_firebase_sw),
|
||||
# Authentication -------------------------------------------------
|
||||
path("login/", auth.custom_login, name="login"),
|
||||
path("logout/", auth_views.LogoutView.as_view(next_page="/login/"), name="logout"),
|
||||
# Password Management --------------------------------------------
|
||||
path("password-reset/", auth.reset_password_options, name="password_reset"),
|
||||
# Firebase Service -----------------------------------------------
|
||||
path("firebase-messaging-sw.js", views.serve_firebase_sw),
|
||||
]
|
||||
|
||||
# Add static and media file serving in development
|
||||
# Static and Media Files (Development Only) --------------------------
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
# Error Handlers ----------------------------------------------------
|
||||
handler400 = "app.error_handlers.handler400"
|
||||
handler403 = "app.error_handlers.handler403"
|
||||
handler404 = "app.error_handlers.handler404"
|
||||
handler500 = "app.error_handlers.handler500"
|
||||
handler505 = "app.error_handlers.handler505"
|
||||
|
||||
@@ -11,6 +11,6 @@ import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'student_management_system.settings')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "student_management_system.settings")
|
||||
|
||||
application = get_wsgi_application()
|
||||
Reference in new issue
Block a user