Skip to content

Commit

Permalink
Sync with production
Browse files Browse the repository at this point in the history
  • Loading branch information
Newton Mugaya committed Jul 24, 2024
1 parent 1cbb146 commit 8310f4d
Show file tree
Hide file tree
Showing 3,825 changed files with 438,252 additions and 15,164 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Empty file modified LICENSE
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Revised tools implementation (Version March 2022)

## Installation

git clone https://github.com/uonafya/cpims-ovc-3.0\
git clone https://github.com/uonafya/cpims-ovc-3.0
Edit cpims/settings.py with your credentials\

python manage.py makemigrations\
Expand Down
Empty file modified configs/nginx/nginx.conf
100644 → 100755
Empty file.
Empty file modified configs/postgresql/pg_hba.conf
100644 → 100755
Empty file.
Empty file modified configs/postgresql/postgresql.conf
100644 → 100755
Empty file.
Empty file modified configs/selinux/config
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions configs/uwsgi/cpims.ini
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ home = %(base)/.envs/cpims_app
module = %(project).wsgi:application
master = true
processes = 10
threads = 10
threads = 20
enable-threads = True
uid = %(username)
socket = /run/uwsgi/%(project).sock
chown-socket = %(username):nginx
chmod-socket = 660
chmod-socket = 1200
vacuum = true
env = CPIMS_HOST=localhost
env = CPIMS_DB=cpims
Expand Down
Empty file modified contributors.txt
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions cpims/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .celery import app as celery_app

__version__ = '2.0.3'
VERSION = __version__

# Celery
__all__ = ("celery_app",)
Empty file modified cpims/apps.py
100644 → 100755
Empty file.
16 changes: 16 additions & 0 deletions cpims/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for cpims 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.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cpims.settings')

application = get_asgi_application()
10 changes: 10 additions & 0 deletions cpims/celery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os
from celery import Celery


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cpims.settings")
app = Celery("cpims")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()

# python -m celery -A cpims worker -l info
Empty file modified cpims/emails.py
100644 → 100755
Empty file.
Empty file modified cpims/logging_config.py
100644 → 100755
Empty file.
116 changes: 77 additions & 39 deletions cpims/settings.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"""

import os
from datetime import timedelta
from django.urls import reverse_lazy

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand All @@ -18,23 +20,20 @@
cpims_db_host = os.environ.get(
'CPIMS_HOST') if os.environ.get('CPIMS_HOST') else '127.0.0.1'
cpims_db_pass = os.environ.get(
'CPIMS_PASSWORD') if os.environ.get('CPIMS_PASSWORD') else 'Xaen!ee8'
'CPIMS_PASSWORD') if os.environ.get('CPIMS_PASSWORD') else ''
cpims_db_instance = os.environ.get(

'CPIMS_DB') if os.environ.get('CPIMS_DB') else 'cpims'

'CPIMS_DB') if os.environ.get('CPIMS_DB') else ''
cpims_db_port = os.environ.get(
'CPIMS_PORT') if os.environ.get('CPIMS_PORT') else '5432'
'CPIMS_PORT') if os.environ.get('CPIMS_PORT') else ''
cpims_db_user = os.environ.get(
'CPIMS_DBUSER') if os.environ.get('CPIMS_DBUSER') else 'cpimsdbuser'
'CPIMS_DBUSER') if os.environ.get('CPIMS_DBUSER') else ''
cpims_debug = eval(os.environ.get(

'CPIMS_DEBUG')) if os.environ.get('CPIMS_DEBUG') else True


DEBUG = cpims_debug

INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
Expand All @@ -49,20 +48,28 @@
'cpovc_access',
'cpovc_settings',
'crispy_forms',
'crispy_bootstrap3',
'cpovc_ovc',
'import_export',
'rest_framework',
'data_cleanup',
'cpovc_offline_mode',
'cpovc_manage',
'forums',
'adminsortable',
'simple_forums',
'cpovc_manage',
'notifications',
'cpovc_help',
'cpovc_pfs',

'cpovc_preventive',
'cpovc_pmtct',
'cpovc_dashboard',
'cpovc_dreams',
'rest_framework.authtoken',
'rest_framework_simplejwt',
'cpovc_api',
'cpovc_dashboards',
'cpovc_mobile',
'cpovc_hes',
'django.contrib.humanize',
'drf_spectacular',
'drf_spectacular_sidecar',
]


Expand Down Expand Up @@ -94,9 +101,6 @@
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'cpovc_main.context_processors.global_settings',

'simple_forums.context_processors.installed_apps',

],
},
},
Expand Down Expand Up @@ -149,7 +153,8 @@

ALLOW_NATIONAL_ID_LOGIN = True

CRISPY_TEMPLATE_PACK = 'bootstrap3'
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap3"
CRISPY_TEMPLATE_PACK = "bootstrap3"

# to find out what this does
IS_CAPTURE_SITE = False
Expand All @@ -159,24 +164,28 @@
SESSION_EXPIRE_AT_BROWSER_CLOSE = True

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

DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
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 = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}

AXES_LOCKOUT_TEMPLATE = 'locked.html'
Expand Down Expand Up @@ -207,16 +216,10 @@

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

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
CSRF_FAILURE_VIEW = 'cpims.views.csrf_failure'

OFFLINE_MODE_CAPABILITY_ENABLED = eval(
os.environ.get('CAN_WORK_OFFLINE', 'True'))
os.environ.get('CAN_WORK_OFFLINE', 'False'))

# kmhfl API
KMHFL_USERNAME = '10004'
Expand All @@ -231,15 +234,50 @@
KMHFL_SUBCOUNTY_BASE_URL = ''
KMHFL_TOKEN_URL = ''

# nascop API
# NASCOP API
NASCOP_URL = 'https://api.nascop.org/vl/ver2.0/'

NASCOP_API_BASE_URL = os.environ.get(
'NASCOP_API_BASE_URL') if os.environ.get('NASCOP_API_BASE_URL') else ''
'NASCOP_API_BASE_URL') if os.environ.get(
'NASCOP_API_BASE_URL') else NASCOP_URL + 'patient/results/'
NASCOP_LOGIN_URL = os.environ.get(
'NASCOP_LOGIN_URL') if os.environ.get('NASCOP_LOGIN_URL') else ''
'NASCOP_LOGIN_URL') if os.environ.get(
'NASCOP_LOGIN_URL') else NASCOP_URL + 'login'
NASCOP_EMAIL = os.environ.get(
'NASCOP_EMAIL') if os.environ.get('NASCOP_EMAIL') else ''
'NASCOP_EMAIL') if os.environ.get(
'NASCOP_EMAIL') else ''
NASCOP_PASSWORD = os.environ.get(
'NASCOP_PASSWORD') if os.environ.get('NASCOP_PASSWORD') else ''

'NASCOP_PASSWORD') if os.environ.get(
'NASCOP_PASSWORD') else ''

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


SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
'UPDATE_LAST_LOGIN': True,
}

SPEC_DESC = """Various APIs for child protection workflows. Registration and Management
of organization Unit (Government and Non Government),
Persons (Workforce, Children and Caregivers).
Case Management for DCS (Case Record sheet, Alternative Care,
Statutory and Charitable Institution care
and OVC Case Management (F1A, F1B, Case Plan, CPARA, HIV management, HIV Risk Screening).
<hr><br><a href='/api/'>API Home (Click here)</a>"""

SPECTACULAR_SETTINGS = {
"TITLE": "Child Protection Information Management System",
"DESCRIPTION": SPEC_DESC,
"VERSION": "1.0.0",
"PREPROCESSING_HOOKS": [],
# Custom Spectacular Settings
"EXCLUDE_PATH": [reverse_lazy("schema")],
}
# "spectacular.hooks.remove_apis_from_list"

# Celery settings
CELERY_BROKER_URL = "redis://localhost:6379"
CELERY_RESULT_BACKEND = "redis://localhost:6379"
Empty file modified cpims/settings_BACKUP_28360.py
100644 → 100755
Empty file.
Empty file modified cpims/settings_BASE_28360.py
100644 → 100755
Empty file.
Empty file modified cpims/settings_LOCAL_28360.py
100644 → 100755
Empty file.
Empty file modified cpims/settings_REMOTE_28360.py
100644 → 100755
Empty file.
Loading

0 comments on commit 8310f4d

Please sign in to comment.