Commit 362b1af3 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

Updating Django minor version & 3rd party packages

Updated from Django 1.11.5 to Django 1.11.14. Updated 3rd party
packages so that all of them have version requirements in
requirements.txt.  Also updated most of these packages to use the
newest versions.  A specific update to the twilio package required
some changes for how we determine the 'from' phone number. Also
alphabetized the packages in this file.  Finally, added the very
useful django-silk debugger/profiler.
parent 37ae63b7
......@@ -16,17 +16,28 @@ EMBB_MAIL_ADDRESS = 'gracedb@{fqdn}'.format(fqdn=SERVER_FQDN)
debug_middleware = 'debug_toolbar.middleware.DebugToolbarMiddleware'
MIDDLEWARE += [
debug_middleware,
'silk.middleware.SilkyMiddleware',
#'core.middleware.profiling.ProfileMiddleware',
]
# Add to installed apps
INSTALLED_APPS += [
'debug_toolbar',
'silk'
]
# Add testserver to ALLOWED_HOSTS
ALLOWED_HOSTS += ['testserver']
# Settings for django-silk profiler
SILKY_AUTHENTICATION = True
SILKY_AUTHORISATION = True
if 'silk' in INSTALLED_APPS:
# Needed to prevent RequestDataTooBig for files > 2.5 MB
# when silk is being used. This setting is typically used to
# prevent DOS attacks, so should not be changed in production.
DATA_UPLOAD_MAX_MEMORY_SIZE = 20*(1024**2)
# Add XForwardedFor middleware directly before debug_toolbar middleware
# if debug_toolbar is enabled and DEBUG is True.
if DEBUG and debug_middleware in MIDDLEWARE:
......
......@@ -44,7 +44,7 @@ urlpatterns = [
# {'document_root': settings.LATENCY_REPORT_DEST_DIR}),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
......@@ -52,7 +52,18 @@ urlpatterns = [
]
if settings.DEBUG:
# We don't require settings.DEBUG for django-silk since running unit tests
# by default setings settings.DEBUG to False, unless you use the
# --debug-mode flag
if settings.DEBUG or ('silk' in settings.INSTALLED_APPS and
['silk' in m for m in settings.MIDDLEWARE]):
# Add django-silk
urlpatterns = [
url(r'^silk/', include('silk.urls', namespace='silk'))
] + urlpatterns
# Add django-debug-toolbar
if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
......
......@@ -49,7 +49,7 @@ TWILIO_MSG_CONTENT = {
def get_twilio_from():
"""Gets phone number which Twilio alerts come from."""
for from_ in twilio_client.phone_numbers.iter():
for from_ in twilio_client.incoming_phone_numbers.list():
return from_.phone_number
raise RuntimeError('Could not determine "from" Twilio phone number')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment