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.

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