#84 enabled the django debug to appear in the index page when in development stage
Closed 5 years ago by jflory7. Opened 5 years ago by feisal.
Unknown source displayed_DDT  into  master

@@ -9,7 +9,8 @@

  # 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 @@

      '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.

@@ -18,7 +18,7 @@

  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 @@

  INSTALLED_APPS += (

      'debug_toolbar',

  )

+ MIDDLEWARE_CLASSES+=['debug_toolbar.middleware.DebugToolbarMiddleware' , ]

+ 

+ # DEBUG TOOLBAR SETTINGS:

+ 

+ 

+ 

  

  SELENIUM_SCREENSHOT_DIR = PROJECT_DIR.child('selenium-screenshots')

  

file modified
+9 -1
@@ -4,14 +4,22 @@

  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<path>.*)$', django.views.static.serve, {'document_root': settings.MEDIA_ROOT}))

file modified
+8 -1
@@ -20,7 +20,14 @@

  # 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

file modified
+8 -1
@@ -3,7 +3,14 @@

  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

  

  1. Enabled the DJango Debug too to be displayed in the index page for efficient and faster debugging when the project is in development stage
  2. inserted good documentation to easily follows my changes

Hi, see my feedback in this comment about this pull request.

Pull-Request has been closed by jflory7

5 years ago