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.

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