settings.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. """
  2. Django settings for bototest project.
  3. For more information on this file, see
  4. https://docs.djangoproject.com/en/1.6/topics/settings/
  5. For the full list of settings and their values, see
  6. https://docs.djangoproject.com/en/1.6/ref/settings/
  7. """
  8. from unipath import Path
  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(__file__))
  12. # Quick-start development settings - unsuitable for production
  13. # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = 'c8v$9#wyh+w#0^$gaa8@s1!q6270ensho@=ludl*jvt)a*0$5('
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. TEMPLATE_DEBUG = True
  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. 'storages',
  28. 'upload',
  29. 'registration',
  30. 'bootstrap3',
  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.messages.middleware.MessageMiddleware',
  38. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  39. )
  40. ROOT_URLCONF = 'bototest.urls'
  41. WSGI_APPLICATION = 'bototest.wsgi.application'
  42. #####
  43. # S3 Storage
  44. #####
  45. DEFAULT_FILE_STORAGE = 'bototest.s3utils.MediaS3BotoStorage'
  46. STATICFILES_STORAGE = 'bototest.s3utils.StaticS3BotoStorage'
  47. AWS_ACCESS_KEY_ID = 'xxxxxxxx'
  48. AWS_SECRET_ACCESS_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  49. AWS_STORAGE_BUCKET_NAME = 'osmium'
  50. S3_URL = 'http://%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
  51. STATIC_DIRECTORY = '/static/'
  52. MEDIA_DIRECTORY = '/media/'
  53. STATIC_URL = S3_URL + STATIC_DIRECTORY
  54. MEDIA_URL = S3_URL + MEDIA_DIRECTORY
  55. # Database
  56. # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
  57. DATABASES = {
  58. 'default': {
  59. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  60. 'NAME': 'bototest_db',
  61. }
  62. }
  63. # Internationalization
  64. # https://docs.djangoproject.com/en/1.6/topics/i18n/
  65. LANGUAGE_CODE = 'en-us'
  66. TIME_ZONE = 'UTC'
  67. USE_I18N = True
  68. USE_L10N = True
  69. USE_TZ = True
  70. # Static files (CSS, JavaScript, Images)
  71. # https://docs.djangoproject.com/en/1.6/howto/static-files/
  72. PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
  73. PROJECT_DIR = Path(PROJECT_ROOT).parent
  74. PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
  75. STATIC_ROOT = 'staticfiles'
  76. STATIC_URL = '/static/'
  77. STATICFILES_DIRS = (
  78. os.path.join(PROJECT_PATH, 'static'),
  79. )
  80. STATICFILES_FINDERS = (
  81. 'django.contrib.staticfiles.finders.FileSystemFinder',
  82. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  83. # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
  84. )
  85. TEMP_ROOT = os.path.join(PROJECT_ROOT, 'temp')
  86. TEMP_URL = '/temp/'
  87. TEMPLATE_CONTEXT_PROCESSORS = (
  88. 'django.core.context_processors.request',
  89. 'django.contrib.auth.context_processors.auth',
  90. )
  91. TEMPLATE_LOADERS = (
  92. 'django.template.loaders.filesystem.Loader',
  93. 'django.template.loaders.app_directories.Loader'
  94. )
  95. TEMPLATE_DIRS = (
  96. PROJECT_DIR.child("templates"),
  97. )
  98. import dj_database_url
  99. DATABASES['default'] = dj_database_url.config()
  100. # Honor the 'X-Forwarded-Proto' header for request.is_secure()
  101. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  102. # Allow all host headers
  103. ALLOWED_HOSTS = ['*']