Advertisement
tclancy

Example Settings 1.4

Aug 28th, 2012
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.12 KB | None | 0 0
  1. import os
  2. import sys
  3.  
  4. DEBUG = True
  5. TEMPLATE_DEBUG = DEBUG
  6. SERVE_MEDIA = True
  7. USE_CACHE = False
  8.  
  9. ADMINS = (
  10.     ('Me', '[email protected]'),
  11. )
  12.  
  13. DATABASES = {
  14.    'default': {
  15.         'ENGINE': 'django.db.backends.postgresql_psycopg2',
  16.         'NAME': 'project',
  17.         'USER': 'x',
  18.         'PASSWORD': 'x',
  19.         'HOST': 'localhost'
  20.    }
  21. }
  22.  
  23. INTERNAL_IPS = ('127.0.0.1',)
  24. DEBUG_TOOLBAR_CONFIG = {}
  25. DEBUG_TOOLBAR_CONFIG['INTERCEPT_REDIRECTS'] = False
  26.  
  27. SENTRY_TESTING = True
  28. SENTRY_PUBLIC = True
  29.  
  30. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  31.  
  32. if 'test' in sys.argv:
  33.     DATABASES = {
  34.         'default': {
  35.              'ENGINE': 'django.db.backends.sqlite3',
  36.              'NAME': 'project',
  37.         }
  38.      }
  39. SOUTH_TESTS_MIGRATE = False
  40. DEBUG_PROPAGATE_EXCEPTIONS = True
  41.  
  42. PROJECT_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
  43.  
  44. MANAGERS = ADMINS
  45.  
  46. TIME_ZONE = 'America/New_York'
  47.  
  48. LANGUAGE_CODE = 'en-us'
  49.  
  50. SITE_ID = 1
  51.  
  52. USE_I18N = False
  53. USE_L10N = False
  54. USE_TZ = True
  55.  
  56. # Absolute filesystem path to the directory that will hold user-uploaded files.
  57. # Example: "/home/media/media.lawrence.com/media/"
  58. MEDIA_ROOT = ''
  59.  
  60. MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'includes')
  61. MEDIA_URL = '/includes/'
  62.  
  63. DEFAULT_CACHE_TIMEOUT = 60 * 60 * 10
  64. SESSION_COOKIE_PATH = '/;HttpOnly'
  65.  
  66. TEMPLATE_DIRS = (
  67.     os.path.join(PROJECT_ROOT, 'templates'),
  68. )
  69.  
  70. STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
  71. STATIC_URL = '/includes/admin/'
  72. STATICFILES_DIRS = ()
  73.  
  74. STATICFILES_FINDERS = (
  75.     'django.contrib.staticfiles.finders.FileSystemFinder',
  76.     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  77. )
  78.  
  79. # Make this unique, and don't share it with anybody.
  80. SECRET_KEY = 'x'
  81.  
  82. # List of callables that know how to import templates from various sources.
  83. TEMPLATE_LOADERS = (
  84.     'django.template.loaders.filesystem.Loader',
  85.     'django.template.loaders.app_directories.Loader',
  86. )
  87.  
  88. TEMPLATE_CONTEXT_PROCESSORS = (
  89.     "django.contrib.auth.context_processors.auth",
  90.     "django.core.context_processors.media",
  91.     "django.core.context_processors.request",
  92.     "django.core.context_processors.csrf",
  93.     "django.core.context_processors.static",
  94. )
  95.  
  96. MIDDLEWARE_CLASSES = (
  97.     'django.middleware.common.CommonMiddleware',
  98.     'django.contrib.sessions.middleware.SessionMiddleware',
  99.     'django.middleware.csrf.CsrfViewMiddleware',
  100.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  101.     'django.contrib.messages.middleware.MessageMiddleware',
  102. )
  103.  
  104. ROOT_URLCONF = 'project.urls'
  105.  
  106. # Python dotted path to the WSGI application used by Django's runserver.
  107. WSGI_APPLICATION = 'project.wsgi.application'
  108.  
  109. INSTALLED_APPS = (
  110.     'django.contrib.auth',
  111.     'django.contrib.contenttypes',
  112.     'django.contrib.sessions',
  113.     'django.contrib.sites',
  114.     'django.contrib.messages',
  115.     'django.contrib.staticfiles',
  116.     'grappelli',
  117.     'django.contrib.admin',
  118.     'south',
  119. )
  120.  
  121. GRAPPELLI_ADMIN_TITLE = 'Project'
  122.  
  123. LOGGING = {
  124.     'version': 1,
  125.     'disable_existing_loggers': False,
  126.     'formatters': {
  127.         'standard': {
  128.             'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
  129.             'datefmt' : "%d/%b/%Y %H:%M:%S"
  130.         },
  131.     },
  132.     'handlers': {
  133.         'mail_admins': {
  134.             'level': 'ERROR',
  135.             'class': 'django.utils.log.AdminEmailHandler'
  136.         },
  137.         'logfile': {
  138.             'level':'DEBUG',
  139.             'class':'logging.handlers.RotatingFileHandler',
  140.             'filename': os.path.join(PROJECT_ROOT, "project", "logs", "jobs.log"),
  141.             'maxBytes': 500000,
  142.             'backupCount': 2,
  143.             'formatter': 'standard',
  144.         },
  145.         'console':{
  146.             'level':'INFO',
  147.             'class':'logging.StreamHandler',
  148.             'formatter': 'standard'
  149.         },
  150.     },
  151.     'loggers': {
  152.         'django.request': {
  153.             'handlers': ['mail_admins'],
  154.             'level': 'ERROR',
  155.             'propagate': True,
  156.         },
  157.         'project': {
  158.             'handlers': ['console', 'logfile'],
  159.             'level': 'DEBUG',
  160.         },
  161.     }
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement