Project And Teamorganisation Tool
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

settings.py 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. """
  2. Django settings for this project.
  3. Generated by 'django-admin startproject' using Django 2.2.3.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/2.2/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/2.2/ref/settings/
  8. """
  9. try:
  10. from config import config
  11. # required keys: SECRET_KEY
  12. # optional keys: ALLOWED_HOSTS, DEFAULT_THEME
  13. except ImportError:
  14. config = {}
  15. import os
  16. import random
  17. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  18. #
  19. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  20. # Quick-start development settings - unsuitable for production
  21. # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
  22. # SECURITY WARNING: keep the secret key used in production secret!
  23. #
  24. try:
  25. SECRET_KEY = config['SECRET_KEY']
  26. except KeyError:
  27. chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
  28. s_key = ''.join([random.choice(chars) for n in range(50)])
  29. secret_key_warning = "You need to create a config.py file including a variable config which is a dict with at least a SECRET_KEY definition (e.g.: %s)." % repr(s_key)
  30. raise KeyError(secret_key_warning)
  31. # SECURITY WARNING: don't run with debug turned on in production!
  32. #
  33. DEBUG = True
  34. ALLOWED_HOSTS = config.get('ALLOWED_HOSTS', [])
  35. # Application definition
  36. #
  37. INSTALLED_APPS = [
  38. 'patt.apps.PattConfig',
  39. 'themes.apps.ThemesConfig',
  40. 'users.apps.UsersConfig',
  41. 'mycreole.apps.MycreoleConfig',
  42. #
  43. 'django.contrib.admin',
  44. 'django.contrib.auth',
  45. 'django.contrib.contenttypes',
  46. 'django.contrib.sessions',
  47. 'django.contrib.messages',
  48. 'django.contrib.staticfiles',
  49. 'simple_history',
  50. ]
  51. MIDDLEWARE = [
  52. 'django.middleware.security.SecurityMiddleware',
  53. 'django.contrib.sessions.middleware.SessionMiddleware',
  54. 'django.middleware.locale.LocaleMiddleware',
  55. 'django.middleware.common.CommonMiddleware',
  56. 'django.middleware.csrf.CsrfViewMiddleware',
  57. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  58. 'django.contrib.messages.middleware.MessageMiddleware',
  59. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  60. 'simple_history.middleware.HistoryRequestMiddleware',
  61. 'users.middleware.SettingsMiddleware',
  62. ]
  63. ROOT_URLCONF = 'main.urls'
  64. TEMPLATES = [
  65. {
  66. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  67. 'DIRS': [],
  68. 'APP_DIRS': True,
  69. 'OPTIONS': {
  70. 'context_processors': [
  71. 'django.template.context_processors.debug',
  72. 'django.template.context_processors.request',
  73. 'django.contrib.auth.context_processors.auth',
  74. 'django.contrib.messages.context_processors.messages',
  75. ],
  76. },
  77. },
  78. ]
  79. WSGI_APPLICATION = 'main.wsgi.application'
  80. # Database
  81. # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
  82. #
  83. DATABASES = {
  84. 'default': {
  85. 'ENGINE': 'django.db.backends.sqlite3',
  86. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  87. }
  88. }
  89. # Password validation
  90. # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
  91. #
  92. AUTH_PASSWORD_VALIDATORS = [
  93. {
  94. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  95. },
  96. {
  97. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  98. },
  99. {
  100. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  101. },
  102. {
  103. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  104. },
  105. ]
  106. # Search Engine
  107. #
  108. WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh_index')
  109. # Internationalization
  110. # https://docs.djangoproject.com/en/2.2/topics/i18n/
  111. #
  112. LANGUAGE_CODE = 'en-us'
  113. LANGUAGES = [
  114. ('en', 'English'),
  115. ('de', 'Deutsch'),
  116. ]
  117. TIME_ZONE = 'UTC'
  118. USE_I18N = True
  119. LOCALE_PATHS = [
  120. os.path.join(BASE_DIR, 'themes', 'locale'),
  121. os.path.join(BASE_DIR, 'users', 'locale'),
  122. os.path.join(BASE_DIR, 'patt', 'locale'),
  123. ]
  124. USE_L10N = True
  125. USE_TZ = True
  126. # Static files (CSS, JavaScript, Images)
  127. # https://docs.djangoproject.com/en/2.2/howto/static-files/
  128. #
  129. STATIC_ROOT = os.path.join(BASE_DIR, 'data', 'static')
  130. STATIC_URL = '/static/'
  131. MEDIA_ROOT = os.path.join(BASE_DIR, 'data', 'media')
  132. MEDIA_URL = '/media/'
  133. MYCREOLE_ROOT = os.path.join(BASE_DIR, 'data', 'mycreole')
  134. MYCREOLE_ATTACHMENT_ACCESS = {
  135. 'read': 'patt.access.read_attachment',
  136. 'modify': 'patt.access.modify_attachment',
  137. }
  138. MYCREOLE_EXT_FILTERS = [
  139. 'patt.creole.task_link_filter',
  140. 'patt.creole.tasklist_link_filter',
  141. ]
  142. # Session parameters
  143. #
  144. PERSISTENT_SESSION_VARIABLES = []
  145. # Logging Configuration
  146. #
  147. debug_handler = 'console'
  148. default_handler = [debug_handler] if DEBUG else ['console']
  149. #
  150. LOGGING = {
  151. 'version': 1,
  152. 'disable_existing_loggers': False,
  153. 'formatters': {
  154. 'short': {
  155. 'format': "%(asctime)s \"%(name)s - %(levelname)s - %(message)s\"",
  156. 'datefmt': '[%d/%b/%Y %H:%M:%S]',
  157. },
  158. 'long': {
  159. 'format': """~~~~(%(levelname)-10s)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  160. File "%(pathname)s", line %(lineno)d, in %(funcName)s
  161. %(asctime)s: %(name)s - %(message)s
  162. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~""",
  163. },
  164. },
  165. 'handlers': {
  166. 'console': {
  167. 'level': 'DEBUG',
  168. 'class': 'logging.StreamHandler',
  169. 'formatter': 'short',
  170. },
  171. 'console_long': {
  172. 'level': 'DEBUG',
  173. 'class': 'logging.StreamHandler',
  174. 'formatter': 'long',
  175. },
  176. },
  177. 'loggers': {
  178. 'AUTH': {
  179. 'handlers': default_handler,
  180. 'level': 'INFO',
  181. 'propagate': False,
  182. },
  183. 'ACC': {
  184. 'handlers': default_handler,
  185. 'level': 'INFO',
  186. 'propagate': False,
  187. },
  188. 'APP': {
  189. 'handlers': default_handler,
  190. 'level': 'INFO',
  191. 'propagate': False,
  192. },
  193. 'WHOOSH': {
  194. 'handlers': default_handler,
  195. 'level': 'INFO',
  196. 'propagate': False,
  197. },
  198. 'FSTOOLS': {
  199. 'handlers': default_handler,
  200. 'level': 'INFO',
  201. 'propagate': False,
  202. },
  203. },
  204. }
  205. # Other Configuration issues
  206. #
  207. LOGIN_URL = 'users-login'
  208. # App Configuration
  209. #
  210. DEFAULT_THEME = config.get('DEFAULT_THEME', 'clear-green')