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.

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