You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
4.2 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
8 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. """
  2. Django settings for hc project.
  3. Generated by 'django-admin startproject' using Django 1.8.2.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/1.8/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/1.8/ref/settings/
  8. """
  9. import os
  10. import warnings
  11. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  12. HOST = "localhost"
  13. SECRET_KEY = "---"
  14. DEBUG = True
  15. ALLOWED_HOSTS = []
  16. DEFAULT_FROM_EMAIL = '[email protected]'
  17. USE_PAYMENTS = False
  18. REGISTRATION_OPEN = True
  19. INSTALLED_APPS = (
  20. 'django.contrib.admin',
  21. 'django.contrib.auth',
  22. 'django.contrib.contenttypes',
  23. 'django.contrib.humanize',
  24. 'django.contrib.sessions',
  25. 'django.contrib.messages',
  26. 'django.contrib.staticfiles',
  27. 'compressor',
  28. 'hc.accounts',
  29. 'hc.api',
  30. 'hc.front',
  31. 'hc.payments'
  32. )
  33. MIDDLEWARE = (
  34. 'django.middleware.security.SecurityMiddleware',
  35. 'django.contrib.sessions.middleware.SessionMiddleware',
  36. 'django.middleware.common.CommonMiddleware',
  37. 'django.middleware.csrf.CsrfViewMiddleware',
  38. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  39. 'django.contrib.messages.middleware.MessageMiddleware',
  40. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  41. 'hc.accounts.middleware.TeamAccessMiddleware',
  42. )
  43. AUTHENTICATION_BACKENDS = (
  44. 'hc.accounts.backends.EmailBackend',
  45. 'hc.accounts.backends.ProfileBackend'
  46. )
  47. ROOT_URLCONF = 'hc.urls'
  48. TEMPLATES = [
  49. {
  50. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  51. 'DIRS': [os.path.join(BASE_DIR, 'templates')],
  52. 'APP_DIRS': True,
  53. 'OPTIONS': {
  54. 'context_processors': [
  55. 'django.template.context_processors.debug',
  56. 'django.template.context_processors.request',
  57. 'django.contrib.auth.context_processors.auth',
  58. 'django.contrib.messages.context_processors.messages',
  59. 'hc.payments.context_processors.payments'
  60. ],
  61. },
  62. },
  63. ]
  64. WSGI_APPLICATION = 'hc.wsgi.application'
  65. TEST_RUNNER = 'hc.api.tests.CustomRunner'
  66. # Default database engine is SQLite. So one can just check out code,
  67. # install requirements.txt and do manage.py runserver and it works
  68. DATABASES = {
  69. 'default': {
  70. 'ENGINE': 'django.db.backends.sqlite3',
  71. 'NAME': './hc.sqlite',
  72. }
  73. }
  74. # You can switch database engine to postgres or mysql using environment
  75. # variable 'DB'. Travis CI does this.
  76. if os.environ.get("DB") == "postgres":
  77. DATABASES = {
  78. 'default': {
  79. 'ENGINE': 'django.db.backends.postgresql',
  80. 'USER': 'postgres',
  81. 'NAME': 'hc',
  82. 'TEST': {'CHARSET': 'UTF8'}
  83. }
  84. }
  85. if os.environ.get("DB") == "mysql":
  86. DATABASES = {
  87. 'default': {
  88. 'ENGINE': 'django.db.backends.mysql',
  89. 'USER': 'root',
  90. 'NAME': 'hc',
  91. 'TEST': {'CHARSET': 'UTF8'}
  92. }
  93. }
  94. LANGUAGE_CODE = 'en-us'
  95. TIME_ZONE = 'UTC'
  96. USE_I18N = True
  97. USE_L10N = True
  98. USE_TZ = True
  99. SITE_ROOT = "http://localhost:8000"
  100. SITE_NAME = "healthchecks.io"
  101. PING_ENDPOINT = SITE_ROOT + "/ping/"
  102. PING_EMAIL_DOMAIN = HOST
  103. STATIC_URL = '/static/'
  104. STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
  105. STATIC_ROOT = os.path.join(BASE_DIR, 'static-collected')
  106. STATICFILES_FINDERS = (
  107. 'django.contrib.staticfiles.finders.FileSystemFinder',
  108. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  109. 'compressor.finders.CompressorFinder',
  110. )
  111. COMPRESS_OFFLINE = True
  112. # Discord integration -- override these in local_settings
  113. DISCORD_CLIENT_ID = None
  114. DISCORD_CLIENT_SECRET = None
  115. # Slack integration -- override these in local_settings
  116. SLACK_CLIENT_ID = None
  117. SLACK_CLIENT_SECRET = None
  118. # Pushover integration -- override these in local_settings
  119. PUSHOVER_API_TOKEN = None
  120. PUSHOVER_SUBSCRIPTION_URL = None
  121. PUSHOVER_EMERGENCY_RETRY_DELAY = 300
  122. PUSHOVER_EMERGENCY_EXPIRATION = 86400
  123. # Pushbullet integration -- override these in local_settings
  124. PUSHBULLET_CLIENT_ID = None
  125. PUSHBULLET_CLIENT_SECRET = None
  126. if os.path.exists(os.path.join(BASE_DIR, "hc/local_settings.py")):
  127. from .local_settings import *
  128. else:
  129. warnings.warn("local_settings.py not found, using defaults")