Posts tagged: DJANGO

YAPWF: Aaron Swartz's web.py released

Released today: web.py. (Source, documentation, backstory.)

Even though everybody (including Aaron) refers to this as a framework, it’s a lot more library-like than most of the frameworks it’s ostensibly competing with – by design, it seems. It’s very compact – only about 1000 lines of fairly dense Python. (About 275 of those are a template for pretty error pages adapted from Django though.)

Personally, I find the compact, all-in-one style very appealing. Less for a newbie to absorb and less for an experienced user to keep track of. Yes, it does require a template engine and a database wrapper to be useful, but the core is still extremely lean.

Django Docs in Plucker format

Update: 2005-11-13: A lot has happened with Django in the past two weeks; here’s an updated Plucker version of the docs (337K) for the 74 people who downloaded the last one. To judge by the change in file sizes, Django is sixty-two percent more documented than before! Or somebody slipped one of Wilson’s desktop backgrounds in there. I’m just going to keep popping this post to the top when I have a new version, rather than allowing outdated stuff to sit around.
Update 2005-12-10: Posted a new version (375K). Someday I’ll make this a daily cronjob…
Update 2005-12-29: Updated again (398K).
Update 2006-11-16: Now (finally) a nightly cronjob – see the announcement post for more or just grab it now: http://dpaste.com/static/djangodocs.pdb

Original post, 2005-10-30: Along the lines of the Python Library Reference in Plucker format I posted in July, here’s the latest Django documentation (208KB). (Plucker is an offline reader for the Palm.) I know using a non-WiFi, non-cellphone PDA is terribly retro these days, but that’s the kind of old-world guy I am.

A minimal wiki in Django

A minimal wiki in Django

TheWiki I built a proto-wiki in Django as an exercise for learning how to make a custom template filter. It’s absurdly easy, it turns out. Per the docs I added a templatetags module; here’s all the code in it – wikitags.py:

from django.core import template
register = template.Library()

@register.filter
def wikify(value):
    "Makes WikiWords"
    import re
    wikifier = re.compile(r'\b(([A-Z]+[a-z]+){2,})\b')
    return wikifier.sub(r'<a href="/\1/">\1</a>', value)

Then, in my page template:

{% load wikitags %}
<h1>{{ page.title }}</h1>
<div class="body">
    {{ page.content|wikify }}
</div>
...

I wrote about 60 lines of Python code in total. There are much smaller wiki engines, of course, but given the flexibility and expandability offered by Django I think that’s pretty good.

Rails/Django lovefest in Chicago

SNR Yesterday was the Snakes and Rubies meetup in Chicago, featuring Adrian Holovaty of the Django Project and David Heinemeier Hansson of Ruby on Rails. By all reports it was an informative and enjoyable event, with about 100 to 200 people attending. I’m looking forward to hearing the audio when it becomes available.

In the meanwhile, thinkhole.org has a good roundup of notes and blog postings, and of course there’s always Technorati.

Django template bundle for TextMate

I added Wilson Miner’s TextMate bundle for Django templates to the TextMate bundle repository today. Thanks, Wilson!


comments commented on Sun Jan 15 11:46:27 2006:

the ‘scope’ selectors need to be changed. As is the scope text.html.django doesn’t work. text.html works fine.


Paul commented on Sun Jan 15 13:44:40 2006:

But then you get Django-style coloring in all your HTML files. It works as-is. You do have to specifically select the “language” from the language selector at the bottom of the window.