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.

142 lines
3.8 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
  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. )
  43. ROOT_URLCONF = 'hc.urls'
  44. TEMPLATES = [
  45. {
  46. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  47. 'DIRS': [os.path.join(BASE_DIR, 'templates')],
  48. 'APP_DIRS': True,
  49. 'OPTIONS': {
  50. 'context_processors': [
  51. 'django.template.context_processors.debug',
  52. 'django.template.context_processors.request',
  53. 'django.contrib.auth.context_processors.auth',
  54. 'django.contrib.messages.context_processors.messages',
  55. 'hc.payments.context_processors.payments'
  56. ],
  57. },
  58. },
  59. ]
  60. WSGI_APPLICATION = 'hc.wsgi.application'
  61. TEST_RUNNER = 'hc.api.tests.CustomRunner'
  62. # Default database engine is SQLite. So one can just check out code,
  63. # install requirements.txt and do manage.py runserver and it works
  64. DATABASES = {
  65. 'default': {
  66. 'ENGINE': 'django.db.backends.sqlite3',
  67. 'NAME': './hc.sqlite',
  68. }
  69. }
  70. # You can switch database engine to postgres or mysql using environment
  71. # variable 'DB'. Travis CI does this.
  72. if os.environ.get("DB") == "postgres":
  73. DATABASES = {
  74. 'default': {
  75. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  76. 'NAME': 'hc',
  77. 'USER': 'postgres',
  78. 'TEST': {'CHARSET': 'UTF8'}
  79. }
  80. }
  81. if os.environ.get("DB") == "mysql":
  82. DATABASES = {
  83. 'default': {
  84. 'ENGINE': 'django.db.backends.mysql',
  85. 'USER': 'root',
  86. 'NAME': 'hc',
  87. 'TEST': {'CHARSET': 'UTF8'}
  88. }
  89. }
  90. LANGUAGE_CODE = 'en-us'
  91. TIME_ZONE = 'UTC'
  92. USE_I18N = True
  93. USE_L10N = True
  94. USE_TZ = True
  95. SITE_ROOT = "http://localhost:8000"
  96. PING_ENDPOINT = SITE_ROOT + "/ping/"
  97. PING_EMAIL_DOMAIN = HOST
  98. STATIC_URL = '/static/'
  99. STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
  100. STATIC_ROOT = os.path.join(BASE_DIR, 'static-collected')
  101. STATICFILES_FINDERS = (
  102. 'django.contrib.staticfiles.finders.FileSystemFinder',
  103. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  104. 'compressor.finders.CompressorFinder',
  105. )
  106. COMPRESS_OFFLINE = True
  107. EMAIL_BACKEND = "djmail.backends.default.EmailBackend"
  108. # Pushover integration -- override these in local_settings
  109. PUSHOVER_API_TOKEN = None
  110. PUSHOVER_SUBSCRIPTION_URL = None
  111. PUSHOVER_EMERGENCY_RETRY_DELAY = 300
  112. PUSHOVER_EMERGENCY_EXPIRATION = 86400
  113. if os.path.exists(os.path.join(BASE_DIR, "hc/local_settings.py")):
  114. from .local_settings import *
  115. else:
  116. warnings.warn("local_settings.py not found, using defaults")