forked from tobami/codespeed
-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathsettings.py
More file actions
121 lines (95 loc) · 3.26 KB
/
settings.py
File metadata and controls
121 lines (95 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# -*- coding: utf-8 -*-
# Django settings for a Codespeed project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASEDIR = os.path.abspath(os.path.dirname(__file__))
TOPDIR = os.path.split(BASEDIR)[1]
#: The directory which should contain checked out source repositories:
REPOSITORY_BASE_PATH = os.path.join(BASEDIR, "repos")
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASEDIR, 'data.db'),
}
}
DEFAULT_AUTO_FIELD='django.db.models.AutoField'
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = False
MEDIA_ROOT = os.path.join(BASEDIR, "media")
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
# XXX Set SECRET_KEY in local_settings.py
#with open(os.path.join(BASEDIR, 'secret_key')) as f:
# SECRET_KEY = f.read().strip()
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
if DEBUG:
import traceback
import logging
# Define a class that logs unhandled errors
class LogUncatchedErrors:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
return self.get_response(request)
def process_exception(self, request, exception):
logging.error("Unhandled Exception on request for %s\n%s" %
(request.build_absolute_uri(),
traceback.format_exc()))
# And add it to the middleware classes
MIDDLEWARE += ('speed_python.settings.LogUncatchedErrors',)
# set shown level of logging output to debug
logging.basicConfig(level=logging.DEBUG)
ROOT_URLCONF = '{0}.urls'.format(TOPDIR)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASEDIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.request',
],
},
},
]
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.messages',
'django.contrib.staticfiles',
'codespeed',
'gunicorn',
)
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASEDIR, "sitestatic")
STATICFILES_DIRS = (
os.path.join(BASEDIR, 'static'),
)
# Codespeed settings that can be overwritten here.
from codespeed.settings import *
from .local_settings import *