Sunday, 26 May 2013

Django - External Debugger

Requirements (Choose one)
A. Install into site-packages
pip install django-debug-toolbar
pip install django-extensions
pip install Werkzeug

B. Download and put it all together into a directory
pip install --download="DEBUG" --no-install django-debug-toolbar django-extensions Werkzeug six
Reference: http://www.pip-installer.org/en/latest/cookbook.html
# After download then extract accordingly as following

Directory Tree
Projects
+---My_Project1
|   +---...
|
+---My_Project2
|   +---...
|
+---My_Project3
|   +---...
|
+---DEBUG
|   +---debug_toolbar
|   |   +---...
|
|   +---django_extensions
|   |   +---...
|
|   +---werkzeug
|   |   +---...
|
\---six.py
# I'm using method B.
local_settings.py
import os
import sys

from settings import MIDDLEWARE_CLASSES, INSTALLED_APPS

DEBUG_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../DEBUG').replace('\\','/')
if os.path.exists(DEBUG_DIR):
     sys.path.append(DEBUG_DIR)
     MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
     INSTALLED_APPS += ('debug_toolbar', 'django_extensions',)
     INTERNAL_IPS = ('127.0.0.1',)
     DEBUG_TOOLBAR_CONFIG = {
       'INTERCEPT_REDIRECTS': False,
     }

Source Files:
https://github.com/django-debug-toolbar/django-debug-toolbar
https://github.com/django-extensions/django-extensions
https://github.com/mitsuhiko/werkzeug
https://pypi.python.org/pypi/six # For django-extensions

No comments :

Post a Comment