-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
DJANGO_SECRET_KEY="your_django_password" | ||
POSTGRES_DB="logika_administrative_db" | ||
POSTGRES_HOST="localhost" | ||
POSTGRES_PORT="5432" | ||
POSTGRES_USER="postgres" | ||
POSTGRES_PASSWORD="postgres" | ||
LMS_LOGIN="login" | ||
LMS_PASS="some_pass" | ||
TRELLO_TOKEN="<Trello token>" | ||
TRELLO_KEY="TRELLO_KEY" | ||
TRELLO_SECRET="TRELLO_SECRET" | ||
TRELLO_BOARD_ID="TRELLO_BOARD_ID" | ||
TRELLO_LIST_ID="TRELLO_LIST_ID" | ||
DEBUG="TRUE" | ||
ADMIN_ENABLED="TRUE" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
ASGI config for logika_administrative project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "logika_administrative.settings") | ||
|
||
application = get_asgi_application() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
""" | ||
Django settings for logika_administrative project. | ||
Generated by 'django-admin startproject' using Django 4.2.3. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.2/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/4.2/ref/settings/ | ||
""" | ||
|
||
from pathlib import Path | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
|
||
# Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
BASE_DIR = Path(__file__).resolve().parent.parent | ||
|
||
|
||
load_dotenv(Path(BASE_DIR, ".env")) | ||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY") | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = os.environ.get("DEBUG") == "TRUE" | ||
|
||
ALLOWED_HOSTS = ["*"] | ||
ADMIN_ENABLED = os.environ.get("ADMIN_ENABLED") == "TRUE" | ||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
"django.contrib.admin", | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.messages", | ||
"django.contrib.staticfiles", | ||
"logika_general.apps.LogikaGeneralConfig", | ||
"logika_teachers.apps.LogikaTeachersConfig", | ||
"logika_auth.apps.LogikaAuthConfig", | ||
"logika_statistics.apps.LogikaStatisticsConfig", | ||
"django_sass", | ||
"sass_processor", | ||
"django_extensions", | ||
] | ||
|
||
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", | ||
"logika_general.maintenance_middleware.MaintenanceMiddleware", | ||
] | ||
|
||
MAINTENANCE_MODE = False | ||
|
||
CACHES = { | ||
"default": { | ||
"BACKEND": "django.core.cache.backends.filebased.FileBasedCache", | ||
"LOCATION": BASE_DIR / "cache", | ||
} | ||
} | ||
|
||
ROOT_URLCONF = "logika_administrative.urls" | ||
|
||
TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"DIRS": [ | ||
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", | ||
"utils.get_user_role.get_user_role_by_request", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = "logika_administrative.wsgi.application" | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases | ||
|
||
DATABASES = { | ||
"default": { | ||
"ENGINE": "django.db.backends.postgresql", | ||
"NAME": os.environ.get("POSTGRES_DB"), | ||
"USER": os.environ.get("POSTGRES_USER"), | ||
"PASSWORD": os.environ.get("POSTGRES_PASSWORD"), | ||
"HOST": os.environ.get("POSTGRES_HOST"), | ||
"PORT": os.environ.get("POSTGRES_PORT"), | ||
} | ||
} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/4.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/4.2/topics/i18n/ | ||
|
||
LANGUAGE_CODE = "uk" | ||
|
||
TIME_ZONE = "Europe/Kiev" | ||
|
||
USE_I18N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/4.2/howto/static-files/ | ||
|
||
STATICFILES_FINDERS = [ | ||
"django.contrib.staticfiles.finders.FileSystemFinder", | ||
"django.contrib.staticfiles.finders.AppDirectoriesFinder", | ||
"sass_processor.finders.CssFinder", | ||
] | ||
|
||
STATIC_URL = "/static/" | ||
STATICFILES_DIRS = [BASE_DIR / "static"] | ||
# Static files (CSS, JavaScript, Images) | ||
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") | ||
SASS_PROCESSOR_ROOT = STATIC_ROOT | ||
# Media Files | ||
MEDIA_ROOT = os.path.join(BASE_DIR, "media") | ||
MEDIA_URL = "/media/" | ||
|
||
# Default primary key field type | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" | ||
|
||
LOGIN_URL = "/login/" | ||
LOGIN_REDIRECT_URL = "/" | ||
|
||
|
||
LOGGING = { | ||
"version": 1, | ||
"disable_existing_loggers": False, | ||
"handlers": { | ||
"file": { | ||
"level": "DEBUG", | ||
"class": "logging.FileHandler", | ||
"filename": f"{BASE_DIR}/logging.log", | ||
"formatter": "timestamped", | ||
}, | ||
"console": { | ||
"level": "DEBUG", | ||
"class": "logging.StreamHandler", | ||
"formatter": "timestamped", | ||
}, | ||
}, | ||
"loggers": { | ||
"": { | ||
"handlers": ["file"], | ||
"level": "DEBUG", | ||
"propagate": True, | ||
}, | ||
}, | ||
"formatters": { | ||
"timestamped": { | ||
"format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s", | ||
"datefmt": "%Y-%m-%d %H:%M:%S", | ||
}, | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
URL configuration for logika_administrative project. | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/4.2/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, include | ||
from django.conf import settings | ||
from django.conf.urls.static import static | ||
from logika_general import views as logika_general_views | ||
from logika_administrative.settings import ADMIN_ENABLED | ||
|
||
urlpatterns = [ | ||
path("admin/", admin.site.urls), | ||
path("", include("logika_general.urls", namespace="logika_general")), | ||
path("", include("logika_auth.urls")), | ||
path("logika-teachers/", include("logika_teachers.urls", namespace="logika_teachers")), | ||
path("", include("logika_statistics.urls", namespace="logika_statistics")), | ||
]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
WSGI config for logika_administrative 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/4.2/howto/deployment/wsgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.wsgi import get_wsgi_application | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "logika_administrative.settings") | ||
|
||
application = get_wsgi_application() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
from logika_auth import models | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class LogikaAuthConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "logika_auth" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from django.db import models | ||
from django.contrib.postgres.fields import ArrayField | ||
from django.contrib.auth.models import User | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.urls import path | ||
from logika_auth import views | ||
|
||
urlpatterns = [ | ||
path("create_user", views.create_user, name="create_user"), | ||
path("deactivate_user", views.deactivate_user, name="deactivate_user"), | ||
path("auth_user", views.auth_user, name="auth_user"), | ||
path("update_user", views.update_user, name="update_user") | ||
] |