From e4163e8af1401e2bbdd6b5d74756bcf4e87eac41 Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 8 Mar 2018 22:29:30 -0600 Subject: [PATCH] Add Django Debug Toolbar --- Dockerfile | 3 +-- gallery/settings.py | 4 ++++ gallery/urls.py | 5 +++++ requirements.txt | 1 - run.sh | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3bcc299..691e56d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ ADD . /src RUN set -ex \ && curl -L https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -o /usr/local/bin/wait-for-it.sh \ && chmod +x /usr/local/bin/wait-for-it.sh \ - && pip install -r requirements.txt \ - && python manage.py collectstatic --noinput + && pip install -r requirements.txt CMD python manage.py runserver 0.0.0.0:8000 diff --git a/gallery/settings.py b/gallery/settings.py index a0a7627..c3569ac 100644 --- a/gallery/settings.py +++ b/gallery/settings.py @@ -28,6 +28,9 @@ ALLOWED_HOSTS = ['*'] if DEBUG: INTERNAL_IPS = ('localhost',) + DEBUG_TOOLBAR_CONFIG = { + 'SHOW_TOOLBAR_CALLBACK': (lambda x: True), + } # SMTP server/relay to send error emails (to ADMINS) from ADMINS = [('c0de', 'c0de@c0defox.es')] @@ -52,6 +55,7 @@ INSTALLED_APPS = [ ] if DEBUG: INSTALLED_APPS += [ + 'debug_toolbar', 'debug_panel' ] diff --git a/gallery/urls.py b/gallery/urls.py index a40b5fb..96703fb 100644 --- a/gallery/urls.py +++ b/gallery/urls.py @@ -15,7 +15,12 @@ Including another URLconf """ from django.conf.urls import url from django.contrib import admin +from django.conf import settings urlpatterns = [ url(r'^admin/', admin.site.urls), ] +if settings.DEBUG: + urlpatterns += [ + url(r'^__debug__/', include(__import__('debug_toolbar').urls)), + ] diff --git a/requirements.txt b/requirements.txt index ccc307e..4a145fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,4 +18,3 @@ six==1.10.0 sqlparse==0.2.3 uWSGI==2.0.15 zipstream==1.1.4 -whitenoise==3.3.1 diff --git a/run.sh b/run.sh index 0f21171..0a2a783 100755 --- a/run.sh +++ b/run.sh @@ -2,5 +2,6 @@ cd /portal #cp msmtprc /etc sleep 1 # Hopefully enough for the database to start accepting connections +python manage.py makemigrations python manage.py migrate python manage.py runserver 0.0.0.0:8000