Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
YukihiroSM authored Sep 14, 2023
2 parents b69e148 + 520edf5 commit dbd6653
Show file tree
Hide file tree
Showing 1,015 changed files with 172,032 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .env.sample
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"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,10 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
resources/

staticfiles/

fixture.json
groups.json
session.pickle
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/logika_administrative.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

266 changes: 266 additions & 0 deletions library.py

Large diffs are not rendered by default.

224 changes: 224 additions & 0 deletions location_tm_regional_tutor_mapping.csv

Large diffs are not rendered by default.

Empty file.
16 changes: 16 additions & 0 deletions logika_administrative/asgi.py
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()
199 changes: 199 additions & 0 deletions logika_administrative/settings.py
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",
},
},
}
31 changes: 31 additions & 0 deletions logika_administrative/urls.py
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)

16 changes: 16 additions & 0 deletions logika_administrative/wsgi.py
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()
Empty file added logika_auth/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions logika_auth/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin
from logika_auth import models

6 changes: 6 additions & 0 deletions logika_auth/apps.py
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"
4 changes: 4 additions & 0 deletions logika_auth/models.py
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

3 changes: 3 additions & 0 deletions logika_auth/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
9 changes: 9 additions & 0 deletions logika_auth/urls.py
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")
]
Loading

0 comments on commit dbd6653

Please sign in to comment.