Skip to content

Commit 49131a2

Browse files
zwarediegorusso
authored andcommitted
Adjust settings a bit
1 parent 2272413 commit 49131a2

2 files changed

Lines changed: 69 additions & 3 deletions

File tree

speed_python/generate_secret.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
3+
import os
4+
5+
from django.utils.crypto import get_random_string
6+
7+
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
8+
secret = get_random_string(50, chars)
9+
10+
with open(os.path.join(os.path.dirname(__file__), 'secret_key'), 'w') as f:
11+
f.write(secret)

speed_python/settings.py

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
# Examples: "http://foo.com/media/", "/media/".
5555
ADMIN_MEDIA_PREFIX = '/static/admin/'
5656

57-
# Make this unique, and don't share it with anybody.
58-
SECRET_KEY = 'as%n_m#)^vee2pe91^^@c))sl7^c6t-9r8n)_69%)2yt+(la2&'
57+
with open(os.path.join(BASEDIR, 'secret_key')) as f:
58+
SECRET_KEY = f.read().strip()
5959

6060
# List of callables that know how to import templates from various sources.
6161
TEMPLATE_LOADERS = (
@@ -83,7 +83,7 @@ def process_exception(self, request, exception):
8383
(request.build_absolute_uri(),
8484
traceback.format_exc()))
8585
# And add it to the middleware classes
86-
MIDDLEWARE_CLASSES += ('sample_project.settings.LogUncatchedErrors',)
86+
MIDDLEWARE_CLASSES += ('speed_python.settings.LogUncatchedErrors',)
8787

8888
# set shown level of logging output to debug
8989
logging.basicConfig(level=logging.DEBUG)
@@ -112,6 +112,7 @@ def process_exception(self, request, exception):
112112
'django.contrib.staticfiles',
113113
'codespeed',
114114
'south',
115+
'gunicorn',
115116
)
116117
SOUTH_TESTS_MIGRATE = False
117118

@@ -187,3 +188,57 @@ def process_exception(self, request, exception):
187188
#DEF_BRANCH = "default" # Defines the default branch to be used.
188189
# In git projects, this branch is usually be calles
189190
# "master"
191+
192+
# FIXME: Copied from Django docs (and pared down a bit)
193+
# This is just enough to make gunicorn happy
194+
LOGGING = {
195+
'version': 1,
196+
'disable_existing_loggers': True,
197+
'formatters': {
198+
'verbose': {
199+
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
200+
},
201+
'simple': {
202+
'format': '%(levelname)s %(message)s'
203+
},
204+
},
205+
# 'filters': {
206+
# 'special': {
207+
# '()': 'project.logging.SpecialFilter',
208+
# 'foo': 'bar',
209+
# }
210+
# },
211+
'handlers': {
212+
'null': {
213+
'level': 'DEBUG',
214+
'class': 'django.utils.log.NullHandler',
215+
},
216+
'console': {
217+
'level': 'DEBUG',
218+
'class': 'logging.StreamHandler',
219+
'formatter': 'simple'
220+
},
221+
'mail_admins': {
222+
'level': 'ERROR',
223+
'class': 'django.utils.log.AdminEmailHandler',
224+
# 'filters': ['special']
225+
}
226+
},
227+
'loggers': {
228+
'django': {
229+
'handlers': ['null'],
230+
'propagate': True,
231+
'level': 'INFO',
232+
},
233+
'django.request': {
234+
'handlers': ['mail_admins'],
235+
'level': 'ERROR',
236+
'propagate': False,
237+
},
238+
# 'myproject.custom': {
239+
# 'handlers': ['console', 'mail_admins'],
240+
# 'level': 'INFO',
241+
# 'filters': ['special']
242+
# }
243+
}
244+
}

0 commit comments

Comments
 (0)