Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Si new #42

Merged
merged 9 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
venv
venv
cpims/settings.py
.history
.history/*
.pyc
__pycache__
*.pyc
migrations
230 changes: 230 additions & 0 deletions .history/cpims/settings_20230823115633.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
"""
Django settings for my_tests project.

Generated by 'django-admin startproject' using Django 4.0.4.

For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'f1&qcqi&cfbt)yfz0hco)^4qlenw7(kd1j#i18jpkta(oj8)if'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'cpovc_auth',
'cpovc_registry',
'cpovc_main',
'cpovc_forms',
'cpovc_gis',
'cpovc_access',
'cpovc_ovc',
'cpovc_settings',
'cpovc_manage',
'cpovc_reports',
'cpovc_help',
'cpovc_ctip',
'cpovc_afc',
'cpovc_missing_child',
'notifications',
'crispy_forms',
'rest_framework',
'rest_framework.authtoken',
'cpovc_stat_inst',
]

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',
]

ROOT_URLCONF = 'cpims.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [(os.path.join(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',
],
},
},
]

WSGI_APPLICATION = 'cpims.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'cpims_live',
'USER': 'cpimsdbuser',
'PASSWORD': 'Xaen!ee8',
'HOST': '127.0.0.1',
'PORT': '5432', }
}

# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators

PWD_VALIDATOR = 'django.contrib.auth.password_validation.'

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': PWD_VALIDATOR + 'UserAttributeSimilarityValidator',
},
{
'NAME': PWD_VALIDATOR + 'MinimumLengthValidator',
},
{
'NAME': PWD_VALIDATOR + 'CommonPasswordValidator',
},
{
'NAME': PWD_VALIDATOR + 'NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Africa/Nairobi'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = 'static/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'reports')

# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"), )

STATIC_ROOT = os.path.join(BASE_DIR, 'assets')

AUTH_USER_MODEL = 'cpovc_auth.AppUser'

# AUTHENTICATION_BACKENDS = ('cpovc_auth.backends.CPOVCAuthenticationBackend',)

SESSION_EXPIRE_AT_BROWSER_CLOSE = True

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'cpimskenya@gmail.com'
EMAIL_HOST_PASSWORD = 'disbczrulkewfdry'

DEFAULT_FROM_EMAIL = 'CPIMS Kenya <%s>' % EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

# Session variables
# SESSION_COOKIE_AGE = 3 * 60 * 60
SESSION_SAVE_EVERY_REQUEST = True

REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.TokenAuthentication',
],
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
)
}

AXES_LOCKOUT_TEMPLATE = 'locked.html'
AXES_COOLOFF_TIME = 0.25

PASSWORD_CHANGE_POLICIES = (
('cpovc_access.password_change.PasswordChangeExpired', {}),
('cpovc_access.password_change.PasswordChangeTemporary', {}),
)

PASSWORD_STRENGTH_POLICIES = (
('cpovc_access.password_strength.PasswordMinLength', {}),
('cpovc_access.password_strength.PasswordContainsUpperCase', {}),
('cpovc_access.password_strength.PasswordContainsLowerCase', {}),
('cpovc_access.password_strength.PasswordContainsNumbers', {}),
('cpovc_access.password_strength.PasswordContainsSymbols', {}),
('cpovc_access.password_strength.PasswordUserAttrs', {}),
('cpovc_access.password_strength.PasswordLimitReuse', {}),
('cpovc_access.password_strength.PasswordDisallowedTerms', {
'terms': ['cpims']
}),
)

AUTHENTICATION_POLICIES = (
('cpovc_access.authentication.AuthenticationBasicChecks', {}),
('cpovc_access.authentication.AuthenticationDisableExpiredUsers', {}),
)

DOCUMENT_ROOT = os.path.join(BASE_DIR, 'templates/documents')


CSRF_FAILURE_VIEW = 'cpims.views.csrf_failure'

LOGIN_URL = '/login'

# Ministry, State Dept and Directorate/Dept Details
DCS = {}
DCS['MINISTRY'] = 'MINISTRY OF LABOUR AND SOCIAL PROTECTION'
DCS['STATE_DEPT'] = 'STATE DEPARTMENT FOR SOCIAL PROTECTION '
DCS['STATE_DEPT'] += 'AND SENIOR CITIZENS AFFAIRS'
DCS['NAME'] = 'DIRECTORATE OF CHILDREN SERVICES'

MEDIA_PHOTOS = os.path.join(BASE_DIR, 'photos')

STATICFILES_DIRS = [BASE_DIR / "static", BASE_DIR / "photos", ]

# Do not include forward slash at the end
PHOTO_URL = '/static'
Loading
Loading