Rebuilding The Codedependant Blog

2015 Jan12
I

t has been about 3 years since I launched my blog. At the time the tech was pretty interesting. It was a Django project on mongrel2 app server backed by ZeroMQ and xapian as the search engine. I built out a modular Web UI with a WYSIWYG editor using mootools. But it was rather clunky in how it actually generated HTML and usually required some manual tweaking.

Out With The Old

The WYSIWYG Editor was probably the biggest problem. It took serious liberties in cleaning the HTML and usually resulted in me editing the code by hand in the end. Interesting code blocks with highlighting was a 3 step process and was almost always formatted wrong.

Managing Images was

Read More

Django SQL Tracing Middleware

2013 Jan07
T
here are a number of tools within the Django framework itself as well as he community for inspecting all of the SQL [Django](http://djangoproject.com) is executing. The [Debug Toolbar](http://github.com/django-debug-toolbar/django-debug-toolbar) has be come the defacto standard in that respect. However, most all, if not all of the usual suspects are relying on template tags and rendered html templates / javascript to read the debug information. All fine and good, unless you are building an ajax application that never renders html or makes use of the template hooks.

The simple solution to this problem is to write a middleware class to spit out the sql generated by the database connection for the current request. And

Read More
filed under:  django ansi tracing middleware sql

Running Django On wsgid with Mongrel2 & ZeroMQ

2012 Jun27
I

love Django and I love Python. However, I also love javascript, Node.js, and I even like playing with Ruby and Ruby on Rails. I love playing around with cool web technology in general. But the the one thing I've always hated was building apache correctly to handle all of these different apps and languages only to have to sit Nginx In front of it. What I really want is a single light weight server that can deal with any application written in any language with out having to build modules, plugins or even recompile the server to get everything to work right. What would be even better is if all of these apps running on a single server

Read More

Dynamic Django ModelForms

2012 May05
T

he forms module in Django is pretty amazing and it allows you to do some rather complex things with not a lot of code. Django forms ships with a class called, ModelForm. ModelForm, if you are not familiar, when given a model class, on an instance of a model, will generate a form instance for you complete with validation. You can, of course, specify which fields to exclude from the form and which widgets to use for each field.

Django forms ships with a class called, ModelForm. ModelForms, if you are not familiar, when given a model class, or an instance of a model, will generate a form instance for you complete with validation. You can, of course, specify

Read More
filed under:  python django closure modelform

Base64 Encode Images With Django

2012 Apr13
L

ately, having spent a good deal of time in the mobile web realm, I have increasingly become more of a performance freak. For mobile websites one of the biggest performance killers is doing HTTP requests. It takes a lot of time to setup / tear down the connection. The transfer rates tend to be rather terrible and they chew up battery life. I noticed that images were the biggest culprit of excessive HTTP traffic. Not only from the HTML itself, but CSS background images, which many web developer tend to forget about, can really slow things down. One easy solution around this is to Base64 encode the images and either deliver them in the style sheets or HTML itself.

So

Read More