Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.13 KB | None | 0 0
  1. """
  2. Django settings for document_management project.
  3.  
  4. Generated by 'django-admin startproject' using Django 2.1.1.
  5.  
  6. For more information on this file, see
  7. https://docs.djangoproject.com/en/2.1/topics/settings/
  8.  
  9. For the full list of settings and their values, see
  10. https://docs.djangoproject.com/en/2.1/ref/settings/
  11. """
  12.  
  13. import os
  14. from decouple import config
  15. from os import path
  16.  
  17. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  18. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  19.  
  20. # Quick-start development settings - unsuitable for production
  21. # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
  22.  
  23. # SECURITY WARNING: keep the secret key used in production secret!
  24. # SECRET_KEY = 'f*0-yga-l1a8!q495^+cdk5zbt)w@t+_^^ibfg#4#b@=ulv!v^'
  25. SECRET_KEY = config('SECRET_KEY')
  26.  
  27. # BASE CONFIGURATION
  28. SETTINGS_DIR = path.dirname(__file__)
  29. PROJECT_ROOT = path.dirname(SETTINGS_DIR)
  30. PROJECT_NAME = path.basename(PROJECT_ROOT)
  31.  
  32. # SECURITY WARNING: don't run with debug turned on in production!
  33. # DEBUG = True
  34. DEBUG = config('DEBUG', default=False, cast=bool)
  35.  
  36. ALLOWED_HOSTS = []
  37.  
  38. # It will be used for automated redirect for login required
  39. LOGIN_URL = 'backoffice:login'
  40.  
  41. # Application definition
  42.  
  43. INSTALLED_APPS = [
  44.     'django.contrib.admin',
  45.     'django.contrib.auth',
  46.     'django.contrib.contenttypes',
  47.     'django.contrib.sessions',
  48.     'django.contrib.messages',
  49.     'django.contrib.staticfiles',
  50.     'django.contrib.humanize',
  51.  
  52.     # Third Party
  53.     'compressor',
  54.     'django_extensions',
  55.  
  56.     # Custom
  57.     'document_management.apps.events',
  58.     'document_management.apps.partners',
  59.     'document_management.apps.users',
  60.     'document_management.apps.addendums',
  61.     'document_management.apps.locations',
  62.     'document_management.apps.role_permissions',
  63.     'document_management.apps.documents',
  64.     'document_management.apps.company_regulations',
  65.     'document_management.apps.permission_requests',
  66.     'document_management.apps.official_records'
  67. ]
  68.  
  69. MIDDLEWARE = [
  70.     'django.middleware.security.SecurityMiddleware',
  71.     'django.contrib.sessions.middleware.SessionMiddleware',
  72.     'django.middleware.common.CommonMiddleware',
  73.     'django.middleware.csrf.CsrfViewMiddleware',
  74.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  75.     'django.contrib.messages.middleware.MessageMiddleware',
  76.     'django.middleware.clickjacking.XFrameOptionsMiddleware'
  77. ]
  78.  
  79. ROOT_URLCONF = 'document_management.urls'
  80.  
  81. TEMPLATES = [
  82.     {
  83.         'BACKEND': 'django.template.backends.django.DjangoTemplates',
  84.         'DIRS': [
  85.             path.join(PROJECT_ROOT, "templates")
  86.         ],
  87.         'APP_DIRS': True,
  88.         'OPTIONS': {
  89.             'context_processors': [
  90.                 'django.template.context_processors.debug',
  91.                 'django.template.context_processors.request',
  92.                 'django.contrib.auth.context_processors.auth',
  93.                 'django.contrib.messages.context_processors.messages',
  94.                 # additional options package
  95.                 'django.template.context_processors.static',
  96.                 # project package
  97.                 'document_management.core.context.context_constant'
  98.             ],
  99.         },
  100.     },
  101. ]
  102.  
  103. WSGI_APPLICATION = 'document_management.wsgi.application'
  104.  
  105.  
  106. # Database
  107. # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
  108.  
  109. # DATABASES = {
  110. #     'default': {
  111. #         'ENGINE': 'django.db.backends.sqlite3',
  112. #         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  113. #     }
  114. # }
  115.  
  116.  
  117. # Password validation
  118. # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
  119.  
  120. AUTH_PASSWORD_VALIDATORS = [
  121.     {
  122.         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  123.     },
  124.     {
  125.         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  126.     },
  127.     {
  128.         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  129.     },
  130.     {
  131.         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  132.     },
  133. ]
  134.  
  135. AUTH_USER_MODEL = 'users.User'
  136.  
  137. # Internationalization
  138. # https://docs.djangoproject.com/en/2.1/topics/i18n/
  139.  
  140. LANGUAGE_CODE = 'en-us'
  141.  
  142. COUNTRY = 'ID'
  143.  
  144. COUNTRY_CODE = '62'
  145.  
  146. TIME_ZONE = 'Asia/Jakarta'
  147.  
  148. USE_I18N = True
  149.  
  150. USE_L10N = True
  151.  
  152. USE_TZ = True
  153.  
  154. USE_THOUSAND_SEPARATOR = True
  155.  
  156.  
  157. # Static files (CSS, JavaScript, Images)
  158. # https://docs.djangoproject.com/en/2.1/howto/static-files/
  159.  
  160. # Absolute filesystem path to the directory that will hold user-uploaded files.
  161. # Example: "/home/media/media.lawrence.com/media/"
  162. MEDIA_ROOT = path.join(PROJECT_ROOT, 'media')
  163.  
  164. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  165. # trailing slash.
  166. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  167. # MEDIA_URL = '/media/'
  168.  
  169. # Absolute path to the directory static files should be collected to.
  170. # Don't put anything in this directory yourself; store your static files
  171. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  172. # Example: "/home/media/media.lawrence.com/static/"
  173. STATIC_ROOT = os.path.join(SETTINGS_DIR, 'static')
  174.  
  175. # URL prefix for static files.
  176. # Example: "http://media.lawrence.com/static/"
  177. STATIC_URL = '/static/'
  178.  
  179. # Additional locations of static files
  180. STATICFILES_DIRS = (
  181.     path.join(PROJECT_ROOT, 'static_files'),
  182.     path.join(PROJECT_ROOT, 'node_modules'),
  183.     # additional for compressor
  184.     'compressor.finders.CompressorFinder',
  185. )
  186.  
  187. FILE_UPLOAD_PERMISSIONS = 0o644
  188.  
  189. # List of finder classes that know how to find static files in
  190. # various locations.
  191. STATICFILES_FINDERS = (
  192.     'django.contrib.staticfiles.finders.FileSystemFinder',
  193.     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  194.     # additional for compressor
  195.     'compressor.finders.CompressorFinder',
  196. )
  197.  
  198. # Configurations for compress files
  199. COMPRESS_ENABLED = False
  200. COMPRESS_ROOT = STATIC_ROOT
  201. COMPRESS_OFFLINE = True
  202. COMPRESS_CSS_FILTERS = [
  203.     'compressor.filters.css_default.CssAbsoluteFilter',
  204.     'compressor.filters.cssmin.CSSMinFilter'
  205. ]
  206. COMPRESS_JS_FILTERS = ['compressor.filters.jsmin.JSMinFilter']
  207. COMPRESS_PRECOMPILERS = (
  208.     ('text/x-scss', 'django_libsass.SassCompiler'),
  209. )
  210.  
  211. #  Digital Ocean Spaces
  212. AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')
  213. AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')
  214. AWS_STORAGE_BUCKET_NAME = config('AWS_STORAGE_BUCKET_NAME')
  215. AWS_S3_ENDPOINT_URL = config('AWS_S3_ENDPOINT_URL')
  216. AWS_S3_OBJECT_PARAMETERS = {
  217.     'CacheControl': 'max-age=86400',
  218. }
  219. AWS_LOCATION = config('AWS_LOCATION')
  220. MEDIA_URL = 'https://%s/%s/' % (AWS_S3_ENDPOINT_URL, AWS_LOCATION)
  221. DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
  222.  
  223. # CONSTANT VARIABLE
  224. ROLE_SUPERUSER_ID = 1
  225. ROLE_LEGAL_ID = 2
  226. ROLE_USER_ID = 3
  227.  
  228. MESSAGE_SUCCESS = "success"
  229. MESSAGE_ERROR = "error"
  230.  
  231. GROUP_CONTRACT = 1
  232. GROUP_MOU = 2
  233. GROUP_OFFICIAL_RECORD = 3
  234. GROUP_COMPANY_REGULATION = 4
  235.  
  236. EMPTY_LABEL = "--- select ---"
  237.  
  238. MAX_VALIDATOR_AMOUNT = 10_000_000_000_000  # 10 Trilliun Rupiah
  239. MAX_VALIDATOR_TEXT = "10.000.000.000.000"
  240.  
  241. try:
  242.     from .settings_local import *  # noqa
  243. except ImportError:
  244.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement