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.

148 lines
4.0 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
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. 'djmail',
  28. 'hc.accounts',
  29. 'hc.api',
  30. 'hc.front',
  31. 'hc.payments'
  32. )
  33. MIDDLEWARE_CLASSES = (
  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.auth.middleware.SessionAuthenticationMiddleware',
  39. 'django.contrib.messages.middleware.MessageMiddleware',
  40. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  41. 'django.middleware.security.SecurityMiddleware',
  42. 'hc.accounts.middleware.TeamAccessMiddleware',
  43. )
  44. AUTHENTICATION_BACKENDS = (
  45. 'hc.accounts.backends.EmailBackend',
  46. 'hc.accounts.backends.ProfileBackend'
  47. )
  48. ROOT_URLCONF = 'hc.urls'
  49. TEMPLATES = [
  50. {
  51. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  52. 'DIRS': [os.path.join(BASE_DIR, 'templates')],
  53. 'APP_DIRS': True,
  54. 'OPTIONS': {
  55. 'context_processors': [
  56. 'django.template.context_processors.debug',
  57. 'django.template.context_processors.request',
  58. 'django.contrib.auth.context_processors.auth',
  59. 'django.contrib.messages.context_processors.messages',
  60. 'hc.payments.context_processors.payments'
  61. ],
  62. },
  63. },
  64. ]
  65. WSGI_APPLICATION = 'hc.wsgi.application'
  66. TEST_RUNNER = 'hc.api.tests.CustomRunner'
  67. # Default database engine is SQLite. So one can just check out code,
  68. # install requirements.txt and do manage.py runserver and it works
  69. DATABASES = {
  70. 'default': {
  71. 'ENGINE': 'django.db.backends.sqlite3',
  72. 'NAME': './hc.sqlite',
  73. }
  74. }
  75. # You can switch database engine to postgres or mysql using environment
  76. # variable 'DB'. Travis CI does this.
  77. if os.environ.get("DB") == "postgres":
  78. DATABASES = {
  79. 'default': {
  80. 'ENGINE': 'django.db.backends.postgresql',
  81. 'NAME': 'hc',
  82. 'USER': 'postgres',
  83. 'TEST': {'CHARSET': 'UTF8'}
  84. }
  85. }
  86. if os.environ.get("DB") == "mysql":
  87. DATABASES = {
  88. 'default': {
  89. 'ENGINE': 'django.db.backends.mysql',
  90. 'USER': 'root',
  91. 'NAME': 'hc',
  92. 'TEST': {'CHARSET': 'UTF8'}
  93. }
  94. }
  95. LANGUAGE_CODE = 'en-us'
  96. TIME_ZONE = 'UTC'
  97. USE_I18N = True
  98. USE_L10N = True
  99. USE_TZ = True
  100. SITE_ROOT = "http://localhost:8000"
  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. EMAIL_BACKEND = "djmail.backends.default.EmailBackend"
  113. # Pushover integration -- override these in local_settings
  114. PUSHOVER_API_TOKEN = None
  115. PUSHOVER_SUBSCRIPTION_URL = None
  116. PUSHOVER_EMERGENCY_RETRY_DELAY = 300
  117. PUSHOVER_EMERGENCY_EXPIRATION = 86400
  118. if os.path.exists(os.path.join(BASE_DIR, "hc/local_settings.py")):
  119. from .local_settings import *
  120. else:
  121. warnings.warn("local_settings.py not found, using defaults")