Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/garethr/django-clue

A collection of useful development middleware for Django packaged under a custom runserver command
https://github.com/garethr/django-clue

Last synced: 2 months ago
JSON representation

A collection of useful development middleware for Django packaged under a custom runserver command

Awesome Lists containing this project

README

        

Clue is a simple collection of useful middleware for Django. It currently
provides a handful of new debugging capabilities via a modified runserver command or by loading a collection of middleware.

h2. Installation

Clue wants to be installed somewhere on your python path. The quickest way of achieving that is the packaged setup.py file.

pre. python setup.py install

h2. Usage

pre. ./manage.py runclueserver

Alternatively you can add the middleware to your settings.py file, although it is advisable to avoid running these in a production environment.

pre. if DEBUG:
settings.MIDDLEWARE_CLASSES += (
'clue.middleware.query.QueryMiddleware',
'clue.middleware.profiler.ProfileMiddleware',
'clue.middleware.template.TemplateMiddleware',
'clue.middleware.validate.HtmlValidatorMiddleware',
)

Currently it supports four alternative views for each normal view, all of which are useful for performance tuning or general quality assurance. All of these can be appended to any URL running on the above mentioned development server.

Credit for much of this work goes to others. The middleware was mainly
based on code from Django Snippets, often tweaked and modified for use with
Django 1.0 and with a few changes to the interface. The team at Global Radio
also have similar tools from which I took ideas.

h2. Alternative Views

Simply append the specified query string arguments to a url and it should render useful information depending on which of the following you choose.

h3. Query Analysis

?query - provides a list of queries run to generate the page, including
a breakdown of slow queries and repeated queries.

h3. Template Loading

?template - a list of all the templates used to render the page.

h3. Profiling

?prof - a process profile showing where you spend most of
your time when rendering the view.

h3. Markup validation

?validate - A view which shows the markup validation errors on the page and where they occured. Requires the "Offline Validator":http://htmlhelp.com/tools/validator/offline/index.html.en command line utility.

h2. Licence

Credits have been left in individual files. Except where otherwise stated the code is licensed as follows:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.