Нет описания

settings.py 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. """
  2. Django settings for learning_log project.
  3. Generated by 'django-admin startproject' using Django 1.8.4.
  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. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  10. import os
  11. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  12. # Quick-start development settings - unsuitable for production
  13. # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = 'make_your_own_secret_key'
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. ALLOWED_HOSTS = ['localhost']
  19. # Application definition
  20. INSTALLED_APPS = (
  21. 'django.contrib.admin',
  22. 'django.contrib.auth',
  23. 'django.contrib.contenttypes',
  24. 'django.contrib.sessions',
  25. 'django.contrib.messages',
  26. 'django.contrib.staticfiles',
  27. # Third party apps
  28. 'bootstrap3',
  29. # My apps
  30. 'learning_logs',
  31. 'users',
  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 = 'learning_log.urls'
  44. TEMPLATES = [
  45. {
  46. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  47. 'DIRS': [os.path.join(BASE_DIR, 'learning_log/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. ],
  56. },
  57. },
  58. ]
  59. WSGI_APPLICATION = 'learning_log.wsgi.application'
  60. # Database
  61. # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
  62. DATABASES = {
  63. 'default': {
  64. 'ENGINE': 'django.db.backends.sqlite3',
  65. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  66. }
  67. }
  68. # Internationalization
  69. # https://docs.djangoproject.com/en/1.8/topics/i18n/
  70. LANGUAGE_CODE = 'en-us'
  71. TIME_ZONE = 'UTC'
  72. USE_I18N = True
  73. USE_L10N = True
  74. USE_TZ = True
  75. # Static files (CSS, JavaScript, Images)
  76. # https://docs.djangoproject.com/en/1.8/howto/static-files/
  77. STATIC_URL = '/static/'
  78. # My settings
  79. LOGIN_URL = '/users/login/'
  80. # Settings for django-bootstrap3
  81. BOOTSTRAP3 = {
  82. 'include_jquery': True,
  83. }
  84. # Heroku settings
  85. cwd = os.getcwd()
  86. if cwd == '/app' or cwd[:4] == '/tmp':
  87. import dj_database_url
  88. DATABASES = {
  89. 'default': dj_database_url.config(default='postgres://localhost')
  90. }
  91. # Honor the 'X-Forwarded-Proto' header for request.is_secure().
  92. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  93. # Only allow heroku to host the project.
  94. ALLOWED_HOSTS = ['learning-log-final.herokuapp.com']
  95. DEBUG = False
  96. # Static asset configuration
  97. BASE_DIR = os.path.dirname(os.path.abspath(__file__))
  98. STATIC_ROOT = 'staticfiles'
  99. STATICFILES_DIRS = (
  100. os.path.join(BASE_DIR, 'static'),
  101. )