From 8f9d9a7266852eba357ca7be1046dfac6bbeaef7 Mon Sep 17 00:00:00 2001
From: feysal-Ibrahim
Date: Feb 23 2019 00:58:00 +0000
Subject: [PATCH 1/2] enabled the django debug too to appper in the in the index page when in development stage
---
diff --git a/happinesspackets/settings/base.py b/happinesspackets/settings/base.py
index 249badd..b2fa326 100644
--- a/happinesspackets/settings/base.py
+++ b/happinesspackets/settings/base.py
@@ -9,7 +9,8 @@ PROJECT_DIR = Path(__file__).ancestor(3)
# For clean_pyc to work without complaining
BASE_DIR = PROJECT_DIR
-DEBUG = False
+# DEBUG = False
+DEBUG = True
ADMINS = (
('Anna Philips', 'algogator@fedoraproject.org'),
@@ -69,8 +70,22 @@ MIDDLEWARE_CLASSES = [
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
+ 'debug_toolbar.panels.versions.VersionsPanel' , 'debug_toolbar.panels.timer.TimerPanel' ,
+ 'debug_toolbar.panels.settings.SettingsPanel' , 'debug_toolbar.panels.headers.HeadersPanel' ,
+ 'debug_toolbar.panels.request.RequestPanel' , 'debug_toolbar.panels.sql.SQLPanel' ,
+ 'debug_toolbar.panels.staticfiles.StaticFilesPanel' , 'debug_toolbar.panels.templates.TemplatesPanel' ,
+ 'debug_toolbar.panels.cache.CachePanel' , 'debug_toolbar.panels.signals.SignalsPanel' ,
+ 'debug_toolbar.panels.logging.LoggingPanel' , 'debug_toolbar.panels.redirects.RedirectsPanel'
]
+
+"""
+function to get the django debug toolbar
+"""
+def show_toolbar(request):
+ return True
+
+DEBUG_TOOLBAR_CONFIG={'INTERCEPT_REDIRECT': False , 'SHOW_TOOLBAR_CALLBACK': show_toolbar , }
ROOT_URLCONF = 'happinesspackets.urls'
# Python dotted path to the WSGI application used by Django's runserver.
diff --git a/happinesspackets/settings/dev.py b/happinesspackets/settings/dev.py
index a7ccc0b..20eab94 100644
--- a/happinesspackets/settings/dev.py
+++ b/happinesspackets/settings/dev.py
@@ -18,7 +18,7 @@ DATABASES = {
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
-SECRET_KEY = 'only-for-testing'
+SECRET_KEY = '*_8(8jk-1j&m-zy1p9*giy%$x9ngyr_!s_=g3o-mdcz@h!-x9m'
INTERNAL_IPS = ('127.0.0.1',)
@@ -47,6 +47,12 @@ MIDDLEWARE_CLASSES = [
INSTALLED_APPS += (
'debug_toolbar',
)
+MIDDLEWARE_CLASSES+=['debug_toolbar.middleware.DebugToolbarMiddleware' , ]
+
+# DEBUG TOOLBAR SETTINGS:
+
+
+
SELENIUM_SCREENSHOT_DIR = PROJECT_DIR.child('selenium-screenshots')
diff --git a/happinesspackets/urls.py b/happinesspackets/urls.py
index 375f4d3..a2587aa 100644
--- a/happinesspackets/urls.py
+++ b/happinesspackets/urls.py
@@ -4,14 +4,22 @@ import django
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
+from django.conf.urls.static import static
urlpatterns = [
url(r'^oidc/', include('mozilla_django_oidc.urls')),
url(r'^', include('happinesspackets.messaging.urls', namespace="messaging")),
]
-
+# refactor django toolbar conflict
+"""
+dispalying the django debug toolbar
+"""
if settings.ADMIN_ENABLED or settings.DEBUG:
urlpatterns.append(url(r'^drunken-octo-lama/', include(admin.site.urls)))
+ if settings:
+ import debug_toolbar
+
+ urlpatterns+=[url( '__debug__/' , include( debug_toolbar.urls ) ) , ]
if settings.DEBUG:
urlpatterns.append(url(r'^media/(?P.*)$', django.views.static.serve, {'document_root': settings.MEDIA_ROOT}))
diff --git a/happinesspackets/wsgi.py b/happinesspackets/wsgi.py
index 97f9ef7..65de01c 100644
--- a/happinesspackets/wsgi.py
+++ b/happinesspackets/wsgi.py
@@ -20,7 +20,14 @@ from django.core.wsgi import get_wsgi_application
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "happinesspackets.settings")
+"""
+ you can change this os settings to whatever setting file you want to work
+ note: now the setting is for development only
+ hint: change to os.environ.setdefault( "DJANGO_SETTINGS_MODULE" , "happinesspackets.settings.prod" )/
+ when in production
+ hint: do the same also manage.py file
+ """
+os.environ.setdefault( "DJANGO_SETTINGS_MODULE" , "happinesspackets.settings.dev" )
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
diff --git a/manage.py b/manage.py
index 18f7994..c0d887b 100755
--- a/manage.py
+++ b/manage.py
@@ -3,7 +3,14 @@ import os
import sys
if __name__ == "__main__":
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "happinesspackets.settings")
+ """
+ you can change this os settings to whatever setting file you want to work
+ note: now the setting is for development only
+ hint: change to os.environ.setdefault( "DJANGO_SETTINGS_MODULE" , "happinesspackets.settings.prod" )/
+ when in production
+ """
+ os.environ.setdefault( "DJANGO_SETTINGS_MODULE" , "happinesspackets.settings.dev" )
+
from django.core.management import execute_from_command_line
From ecb50da7109244e928af457f3f5b7ddbac739bdd Mon Sep 17 00:00:00 2001
From: feysal-Ibrahim
Date: Feb 23 2019 01:17:18 +0000
Subject: [PATCH 2/2] fixed and removed one of the duplicates send me happiness button
---
diff --git a/templates/messaging/start.html b/templates/messaging/start.html
index f0562c5..e4edec8 100644
--- a/templates/messaging/start.html
+++ b/templates/messaging/start.html
@@ -19,10 +19,6 @@
trying to spread that feeling.
-
- Send some happiness now!
-
-
How does it work?
Openly expressing appreciation, gratitude, or happiness to other people can be difficult. This is especially