SHARE
TWEET

settings.py

a guest Dec 16th, 2011 3,859 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Django settings for myapp project.
  2.  
  3. import os.path
  4.  
  5. PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
  6.  
  7. DEBUG = False
  8. TEMPLATE_DEBUG = DEBUG
  9.  
  10. ADMINS = (
  11.     # ('Your Name', 'your_email@example.com'),
  12. )
  13.  
  14. MANAGERS = ADMINS
  15.  
  16. DATABASES = {
  17.     'default': {
  18.         'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
  19.         'NAME': 'myappdb',                      # Or path to database file if using sqlite3.
  20.         'USER': 'user',                      # Not used with sqlite3.
  21.         'PASSWORD': 'pass',                  # Not used with sqlite3.
  22.         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
  23.         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
  24.     }
  25. }
  26.  
  27. # Local time zone for this installation. Choices can be found here:
  28. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  29. # although not all choices may be available on all operating systems.
  30. # On Unix systems, a value of None will cause Django to use the same
  31. # timezone as the operating system.
  32. # If running in a Windows environment this must be set to the same as your
  33. # system time zone.
  34. TIME_ZONE = 'UTC'
  35.  
  36. # Language code for this installation. All choices can be found here:
  37. # http://www.i18nguy.com/unicode/language-identifiers.html
  38. LANGUAGE_CODE = 'en-us'
  39.  
  40. SITE_ID = 1
  41.  
  42. # If you set this to False, Django will make some optimizations so as not
  43. # to load the internationalization machinery.
  44. USE_I18N = True
  45.  
  46. # If you set this to False, Django will not format dates, numbers and
  47. # calendars according to the current locale
  48. USE_L10N = True
  49.  
  50. # Absolute filesystem path to the directory that will hold user-uploaded files.
  51. # Example: "/home/media/media.lawrence.com/media/"
  52. MEDIA_ROOT = ''
  53.  
  54. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  55. # trailing slash.
  56. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  57. MEDIA_URL = ''
  58.  
  59. # Absolute path to the directory static files should be collected to.
  60. # Don't put anything in this directory yourself; store your static files
  61. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  62. # Example: "/home/media/media.lawrence.com/static/"
  63. STATIC_ROOT = os.path.join(PROJECT_PATH, 'staticfiles')
  64. #STATIC_ROOT = ""
  65.  
  66. # URL prefix for static files.
  67. # Example: "http://media.lawrence.com/static/"
  68. #STATIC_URL = '/static/'
  69. STATIC_URL = 'https://s3.amazonaws.com/myapp/'
  70.  
  71. # URL prefix for admin static files -- CSS, JavaScript and images.
  72. # Make sure to use a trailing slash.
  73. # Examples: "http://foo.com/static/admin/", "/static/admin/".
  74. ADMIN_MEDIA_PREFIX = 'https://s3.amazonaws.com/myapp/admin/'
  75.  
  76. # Additional locations of static files
  77. STATICFILES_DIRS = (
  78.     # Put strings here, like "/home/html/static" or "C:/www/django/static".
  79.     # Always use forward slashes, even on Windows.
  80.     # Don't forget to use absolute paths, not relative paths.
  81.     os.path.join(PROJECT_PATH, 'static'),
  82. )
  83.  
  84. # List of finder classes that know how to find static files in
  85. # various locations.
  86. STATICFILES_FINDERS = (
  87.     'django.contrib.staticfiles.finders.FileSystemFinder',
  88.     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  89. #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
  90.     'compressor.finders.CompressorFinder',
  91. )
  92.  
  93. # Make this unique, and don't share it with anybody.
  94. SECRET_KEY = '#btws)qr*n61=5(4#73)$7v0xt!s9p8o($zbh!gkb0r)@@18*w'
  95.  
  96. # List of callables that know how to import templates from various sources.
  97. TEMPLATE_LOADERS = (
  98.     'django.template.loaders.filesystem.Loader',
  99.     'django.template.loaders.app_directories.Loader',
  100. #     'django.template.loaders.eggs.Loader',
  101. )
  102.  
  103. MIDDLEWARE_CLASSES = (
  104.     'django.middleware.common.CommonMiddleware',
  105.     'django.contrib.sessions.middleware.SessionMiddleware',
  106.     'django.middleware.csrf.CsrfViewMiddleware',
  107.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  108.     'django.contrib.messages.middleware.MessageMiddleware',
  109. )
  110.  
  111. ROOT_URLCONF = 'myapp.urls'
  112.  
  113. TEMPLATE_DIRS = (
  114.     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  115.     # Always use forward slashes, even on Windows.
  116.     # Don't forget to use absolute paths, not relative paths.
  117.     os.path.join(PROJECT_PATH, 'templates'),
  118. )
  119.  
  120. INSTALLED_APPS = (
  121.     'django.contrib.auth',
  122.     'django.contrib.contenttypes',
  123.     'django.contrib.sessions',
  124.     'django.contrib.sites',
  125.     'django.contrib.messages',
  126.     'django.contrib.staticfiles',
  127.     # Uncomment the next line to enable the admin:
  128.     'django.contrib.admin',
  129.     # Uncomment the next line to enable admin documentation:
  130.     # 'django.contrib.admindocs',
  131.     'gunicorn',
  132.     'storages',
  133.     'compressor',
  134. )
  135.  
  136. TEMPLATE_CONTEXT_PROCESSORS = (
  137.     "django.contrib.auth.context_processors.auth",
  138.     "django.core.context_processors.debug",
  139.     "django.core.context_processors.i18n",
  140.     "django.core.context_processors.media",
  141.     "django.core.context_processors.static",
  142.     "django.core.context_processors.request",
  143. )
  144.  
  145. # A sample logging configuration. The only tangible logging
  146. # performed by this configuration is to send an email to
  147. # the site admins on every HTTP 500 error.
  148. # See http://docs.djangoproject.com/en/dev/topics/logging for
  149. # more details on how to customize your logging configuration.
  150. LOGGING = {
  151.     'version': 1,
  152.     'disable_existing_loggers': False,
  153.     'handlers': {
  154.         'mail_admins': {
  155.             'level': 'ERROR',
  156.             'class': 'django.utils.log.AdminEmailHandler'
  157.         }
  158.     },
  159.     'loggers': {
  160.         'django.request': {
  161.             'handlers': ['mail_admins'],
  162.             'level': 'ERROR',
  163.             'propagate': True,
  164.         },
  165.     }
  166. }
  167.  
  168.  
  169. STATICFILES_STORAGE = 'storage.CachedS3BotoStorage'
  170. COMPRESS_STORAGE = 'storage.CachedS3BotoStorage'
  171. COMPRESS_URL = STATIC_URL
  172. COMPRESS_OUTPUT_DIR = 'cache'
  173.  
  174. AWS_ACCESS_KEY_ID = ''
  175. AWS_SECRET_ACCESS_KEY = ''
  176. AWS_STORAGE_BUCKET_NAME = 'myapp'
RAW Paste Data
Top