Advertisement
Guest User

Untitled

a guest
Apr 13th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. """
  2. Django settings for psychomino project.
  3. For more information on this file, see
  4. https://docs.djangoproject.com/en/1.7/topics/settings/
  5. For the full list of settings and their values, see
  6. https://docs.djangoproject.com/en/1.7/ref/settings/
  7. """
  8. import os
  9.  
  10. from configurations import Configuration, values
  11.  
  12.  
  13. class Common(Configuration):
  14. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  15.  
  16. BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  17.  
  18. # SECURITY WARNING: keep the secret key used in production secret!
  19. SECRET_KEY = values.SecretValue()
  20.  
  21. # SECURITY WARNING: don't run with debug turned on in production!
  22. DEBUG = values.BooleanValue(False)
  23.  
  24. TEMPLATE_DEBUG = values.BooleanValue(DEBUG)
  25.  
  26. ALLOWED_HOSTS = [".herokuapp.com"]
  27. SITE_ID = 1
  28. # Application definition
  29. INSTALLED_APPS = (
  30. 'django.contrib.admin',
  31. 'rest_framework', # for the browsable API templates
  32. 'floppyforms', # For HTML5 form fields
  33. 'crispy_forms', # Required for the default theme's layout
  34. 'imagekit',
  35.  
  36. 'django.contrib.auth',
  37. 'django.contrib.contenttypes',
  38. 'django.contrib.sessions',
  39. 'django.contrib.messages',
  40. 'django.contrib.staticfiles',
  41.  
  42. 'django_extensions',
  43.  
  44. 'psychomino',
  45. 'lessons'
  46. )
  47.  
  48. MIDDLEWARE_CLASSES = (
  49. 'djangosecure.middleware.SecurityMiddleware',
  50. 'django.contrib.sessions.middleware.SessionMiddleware',
  51. 'django.middleware.common.CommonMiddleware',
  52. 'django.middleware.csrf.CsrfViewMiddleware',
  53. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  54. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  55. 'django.contrib.messages.middleware.MessageMiddleware',
  56. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  57. )
  58.  
  59. ROOT_URLCONF = 'psychomino.urls'
  60.  
  61. WSGI_APPLICATION = 'psychomino.wsgi.application'
  62.  
  63. # Database
  64. # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
  65. DATABASES = values.DatabaseURLValue(
  66. 'sqlite:///{}'.format(os.path.join(BASE_DIR, 'db.sqlite3'))
  67. )
  68.  
  69. # Internationalization
  70. # https://docs.djangoproject.com/en/1.7/topics/i18n/
  71. LANGUAGE_CODE = 'fr-fr'
  72.  
  73. TIME_ZONE = 'Europe/Paris'
  74.  
  75. USE_I18N = True
  76.  
  77. USE_L10N = True
  78.  
  79. USE_TZ = True
  80.  
  81. # Static files (CSS, JavaScript, Images)
  82. # https://docs.djangoproject.com/en/1.7/howto/static-files/
  83. PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
  84. PROJECT_DIR = os.path.join(PROJECT_ROOT,'../psychomino')
  85.  
  86. STATIC_URL = '/static/'
  87.  
  88. STATIC_ROOT = os.path.join(PROJECT_ROOT,'staticfiles/')
  89. STATICFILES_DIRS = (
  90. os.path.join(PROJECT_DIR,'static/'),
  91. )
  92.  
  93. MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
  94.  
  95. MEDIA_URL = '/media/'
  96.  
  97. class Development(Common):
  98. """
  99. The in-development settings and the default configuration.
  100. """
  101. DEBUG = True
  102.  
  103. TEMPLATE_DEBUG = True
  104.  
  105. ALLOWED_HOSTS = []
  106.  
  107. INSTALLED_APPS = Common.INSTALLED_APPS + (
  108. 'debug_toolbar',
  109. )
  110.  
  111.  
  112. class Staging(Common):
  113. """
  114. The in-staging settings.
  115. """
  116. INSTALLED_APPS = Common.INSTALLED_APPS + (
  117. 'djangosecure',
  118. )
  119.  
  120. # django-secure
  121. SESSION_COOKIE_SECURE = values.BooleanValue(True)
  122. SECURE_SSL_REDIRECT = values.BooleanValue(True)
  123. SECURE_HSTS_SECONDS = values.IntegerValue(31536000)
  124. SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True)
  125. SECURE_FRAME_DENY = values.BooleanValue(True)
  126. SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True)
  127. SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True)
  128. SECURE_PROXY_SSL_HEADER = values.TupleValue(
  129. ('HTTP_X_FORWARDED_PROTO', 'https')
  130. )
  131.  
  132.  
  133. class Production(Staging):
  134. """
  135. The in-production settings.
  136. """
  137. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement