A Django site.
June 13, 2008

Scott Paul Robertson
spr
Spr: The Ramblings
» Drafts Do Not Go Into The Feed

Remember kids, do not feed your feed drafts. It is unprofessional.

Blog updated to filter out drafts in the RSS feed.

May 21, 2008

Scott Paul Robertson
spr
Spr: The Ramblings
» Yet More Blog Upgrades

Well I've added a few more improvements to the blog software.

  1. Drafts can now be viewed on a login restricted url.
  2. The README file now has details of template tags, an example blog.html, and the CSS used.
  3. Improved doc strings so you can read template tag info in the admin.

There are other things I'd like to see, but this works well for now.

May 20, 2008

Scott Paul Robertson
spr
Spr: The Ramblings
» Updates to the Blog Code

I've made some updates to the software that runs this blog. A few changes that make for good reasons to update:

  1. The subtitle block no long adds the <h2> tag. You'll need to adjust your blog.html to put tags around the subtitle block.
  2. Fixed the way it references your settings. I'm now doing it correctly by writing from django.conf import settings.
  3. Some minor other cleanup.

Share and Enjoy.

May 17, 2008

Seth House
nonic
» Pimping out your .pythonrc.py

I don’t wanna be hatin’ on IPython, but I don’t use it. I often favor fairly extreme minimalism in computing. Why install something if you can accomplish the same (or good enough) with what you have available? IPython has quite a lot of features and syntactic-sugar, but it is overkill for my needs. Instead I’ve been slowly crafting my ~/.pythonrc.py [...]

January 28, 2007

Seth House
nonic
» Learning Django with IPython

IPython is invaluable for learning Django if you don't know much about Python or anything about object-oriented prgramming.

March 6, 2008
» Ask Matt: Java, PHP or Python for beginning web development?

I recently received the email below. At the risk of starting a flame war, I'm posting my response here. Hi Matthew, Sorry to bug you, but I was reading your blog and was hoping you could help me with some advice. I am new to programming and can't q

March 5, 2008

Kevin Kubasik
nonic
For Once I Oneder
» Can Someone Get Us A Real Django IDE?

So the more I work with Django the more I long for a solid development environment to work in. I use Wingware for much of my python development, with its rockin debugger and code completion, its more than I could ask for. Until the curse of the Java class. This quarter I’m taking a Java projects course, most of the class uses Eclipse but a few use Netbeans. My problem is, I got spoiled so fast by the incredible templates support, content suggestions, quick fixes and always dead on code completion. Going back to Wing feels like a halfway-there IDE. I know that pythons interpreted nature makes source completion much more difficult, now I would argue that with an interpreter, you could actually step through the code to some extent. However, I respect that dynamic objects are never gonna be easy to support. My beef is with the lack of support for super-popular frameworks (this goes for everybody!) Ruby on Rails has literally dozens of solid IDEs and a few that are just spectacular (see Aptana, or Netbeans). Why can’t I get even basic highlighting support for my Django templates? Why can’t I get any completion options on Models except my own?

Its just frustrating, Django is still a pleasure to develop in, even with just Gedit and a terminal, but is it really out of the question to consider providing a big pretty environment for those of us that like that?

I did dig up this and this. I guess its a step in the right direction, but its almost embarrassing next to the Rails environments.

February 3, 2008

Doran Barton
fozzmoo
Fozzolog
» Two new interview videos from UTOSC 2007

I've uploaded two more videos to YouTube for OpenSourceTV.tv.

First, we have an interview with Clint Savage of the Utah Open Source Foundation and the main driving force behind last year's first Utah Open Source Conference.

Next, we have an interview with Scott Paul Robertson (AKA "spr") who gave a presentation at UTOSC 2007 on Django and who is also the author of one of my favorite open source utilities: oggify.

I've got at least one more interview to edit and upload and we also have other content coming soon as well.

You can see Clint's interview and Scott's interview and many others by going to my YouTube Open Source TV playlist, or by visiting the UTOSF YouTube group.

February 1, 2008

Clint Savage
herlo
Sexy Sexy Penguins » Tech
» UTOSF HackNight: Part Deux - Tonight

Well, right on the heels of last weekends uber successful HackNight, it looks like the snow may keep some people from coming up, but we’re still planning on having a mostly ad-hoc HackNight tonight.  The project again will be ConMan.

We’re meeting at my place @6:00 in Murray and we’ll have food and hack for a long, long time!

See you all tonight for an awesome hackfest!

January 26, 2008

Clint Savage
herlo
Sexy Sexy Penguins » Tech
» UTOSF HackNight - Tonight: New Location: Guru Labs

UPDATE!

A quick update for those who are planning on attending tonight’s UTOSF HackNight. Its been moved to Guru Labs in Bountiful. If you still need a ride, feel free to email me, herlo1@gmail or you can twitter me at http://twitter.com/herlo.

If you still need a ride up, we’ll carpool/caravan up from my place @6:30 (instead of 7pm) in Murray. I’ll be leaving promptly at 6:30, however. If you’ve never been to Guru Labs, here’s a map.

See you all tonight for an awesome hackfest!

Cheers,

Herlo

» UTOSF HackNight - Tonight: Possible Change of Venue

Well, it appears that I am one of the many victims of Qwest and their lurid line noise issues, thus no DSL for me! Because of this, I’m in the process of scrambling for a new location for our UTOSF HackNight this evening. If anyone who’s coming would like to donate their location, or know of some place central to those in Salt Lake County with free wireless and open all night, let me know. I accept emails at herlo1@gmail or you can twitter me at http://twitter.com/herlo.

If nothing pans out, fear not, I do have a possible alternate location for this event, which I should be able to arrange for by the end of the day as a backup plan. As it stands now, everyone should just arrive at my place @6:30 (instead of 7pm) in Murray and we’ll carpool and caravan as desired.

See you all tonight for an awesome hackfest!

Cheers,

Herlo

January 18, 2008

=Utah Open Source=
Utah Open Source
The Utah Open Source Foundation
» UTOSF Hacking Night

Its coming soon, the Utah Open Source Conference 2008!

and we need some help getting our registration system off the ground!

If you are interested in working on a really cool project, want to learn Django and enjoy some good food, come on over and hack.

The Hackfest will be held at my new home in Murray, Utah! So come and enjoy the new surroundings and hopefully we’ll have the projector and screen up, which means movies and video games. I’m also working on internet access (its Qwest/XMission for now. Soon to be UTOPIA/XMission), but it should be installed by Saturday. If not, we’ll let everyone know an updated location nearby.

Here’s the details:

Date/Time: Saturday, January 26, 2008 / 7pm

Location: Herlo’s house: 5225 Gravenstein Park, Murray, Utah 84123 - Map

Please feel free to ping me on IRC if you have any question.

Cheers,

Clint

January 10, 2008

Kevin Kubasik
nonic
For Once I Oneder
» Scripted Web Frameworks, and why Django Got it Right

So, I've been working on a few small web projects for an assortment of businesses, pretty standard fair stuff, so I've seized the opportunity to finally do something of a personal analysis of the enormous mass of web frameworks out there (Rails, TG, Django etc). Before anyone gets the wrong idea, this is _NOT_ a comparison, its an opinion. I've just been working with Django for the past several days, and I feel like I owe it a little bit of word-of-mouth.

Let me first explain, Django is really a completely different beast than either Rails or TurboGears. In my experiance, it seems that the real goal of those systems is to make sure we have to code as little as often, so massive slews of differently formatted configuration files, naming conventions and templates are really to be expected. Here's the problem, I'm a developer. I _like_ coding. Now, sometimes it is nice to design a SQL schema, and find your objects already waiting for you. Its also nice to have an authentication framework, templates are fine too, as long as its not a whole new language. The problem I started to run into fairly early on was I didn't know the 'Ruby on Rails' way to do it, but knew perfectly well how I might have done it in a chitzy CGI.

Turbo Gears wasn't much better, again, the goals of the project seems to be as little code as possible, but code is a wonderful common denominator, chances are if I'm using a python web framework, I already know python, why do I need a slew of other random file formats and templating systems? While Turbo Gears did offer an interesting GUI API (all AJAX'ed up of course) its still fairly new, and as a result, wasn't really featureful enough for my needs, and I was stuck with it, so I ventured onward.

Now, I had passed over Django initially because some reading left me with the impression that it wasn't nearly as much of a 'Magical Framework' as the other 2. It turnes out, thats what makes it rock. While Django doesn't have a flashy "Build ____ in 10 min screencast', and doesn't try to make decisions for you, its basically a nice pythonic wrapper around all the nasty bits of working with the web. Django only has 1 real config file, and its just python declarations, to handle url mapping, you get regular expressions. I know it doesn't sound glamorus, but after only an hour or so with Django, its abundantly obvious it was designed by real web developers. Theres an incredibly powerful and sleek caching system, a down right dirt easy templating system (its basically python, 20 minutes and you have it down).

I think perhaps the single most defining design decision (and one that does a great job embedding the usefulness of Django) is the lack of 'toolkit' like elements in the API. Instead, JSON and XML serialization are made fast and easy to use. Django doesn't shove a website on you, its really just a set of libraries and tools but with a little more polish and glue. Not to short what Django offers, on the contrary,  I think it brilliant. I know python, so why shouldn't I define my models in SQLObject?

<offtopic> I wanted to apologize for the blog bumps I've been having, I think a post or 2 got reposted to some Planets, I hope it wasn't too irritating! </offtopic>


January 1, 2008

Scott Paul Robertson
spr
Spr: The Ramblings
» My Blog Code

Well, I've cleaned up the Django app that runs this blog. If you look at it, you need to read the README file first. Trust me.

Highlights:

  1. Comments system that uses akismet to filter spam. After-the-fact comment filtering.
  2. RSS feeds on a per-tag basis and one of recent entries.
  3. Uses only the Django admin.
  4. Uses django-svn revision 5994. Probably broken with current versions.
  5. Shamelessly used calendar snippet.
  6. Provided templates that assume all sorts of CSS you probably aren't using! Luckily you only really need to override templates/blog/entry_abbr.html, templates/blog/entry.html, and templates/blog/calendar.html.

Available at hg.scottr.org via Mercurial: hg clone http://hg.scottr.org/blog

November 15, 2007

Adam Olsen
synic
Vimtips Lates Articles
» Django template autoescaping

Vimtips.org is running the SVN version of Django. This morning I ran an svn update, and I ran into my first API change. While looking at my site later on in the day, I noticed that both of my template filters were being HTML escaped, IE, things like < were showing up as &lt;.

My two filters are the pygments highlighting filter (you can see that in action in this article) and the filter that creates the category list at the end of every article (Under this article, it says "Filed Under: Programming, Python, Django").

Looking through the svn changelog, I noticed that they implemented a new feature, called autoescape, which will make every template variable and custom filters autoescape for safety. Using:

1
2
3
{% autoescape off %}
<a href='{{ link.url }}'>{{ link.name }}</a>
{% endautoescape %}

... you can turn off autoescaping. You can also use the Django template filter safe. As for custom filters, to make it so your returned string isn't autoescaped, you have to mark it as safe. Here I'm showing my category list filter with the new safestring.mark_safe() function:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from django.utils import safestring

@register.filter(name='category_list')
def category_list(categories):
    """
        Shows all categories as a list of links separated by commas
    """
    c = []
    for category in categories:
        c.append("<a href='/category/%d'>%s</a>" % (category.id,
            category.name))

    return safestring.mark_safe(", ".join(c))

November 6, 2007

Adam Olsen
synic
Vimtips Lates Articles
» Feed Problems

Sorry about the weird RSS problems my blog has been having. Moving to a new system caused all the GIDs to be different, so all the old articles showed up as new in readers. Also, I'm fairly new to Django, so I forgot things like "categories" and "pub date" in the Feed class (I know, I'm an idiot), so all the feeds showed up in the incorrect order on http://www.openclue.org

Anyway, I think I've finally gotten it all figured out, so hopefully you shouldn't see these oddities anymore.

October 31, 2007

Adam Olsen
synic
Vimtips Lates Articles
» Thoughts on Django

Django is a "high-level Python Web framework that encourages rapid development and clean, pragmatic design." So far, I have absolutely no complaints... and much praise.

Going from never using Django to entirely rewriting my blog and converting all the old entries took me only a few days. I only had to write the HTML templates and a little Python code, and Django does the rest for me, including the entire administration panel where I can edit articles, article categories, links and etc.

Initial impressions are this: I can tell that this is going to be one of those things (like VIM) that is going to make me think "why, oh why, didn't I learn this earlier?"

I had a bit of trouble installing it on my Dreamhost account, but nothing that wasn't covered in their wiki (http://wiki.dreamhost.com/index.php/Django). I basically just had to contact support and ask them to configure my site for Python+FCGI. They were quick to respond and I had it working in a few hours from begin to end.

I am VERY pleased at this point :)

vim tip: Django template syntax definition

Searching Google for helpers for Django developers, I found a few things, but the only thing I've actually decided to use is the syntax definition file, which you can find here: http://www.vim.org/scripts/script.php?script_id=1487

October 29, 2007

Adam Olsen
synic
Vimtips Lates Articles
» Converting from TextPattern to Django

I like TextPattern a lot, but it doesn't seem to work well for programmers. I couldn't ever find a syntax highlighting plugin (that worked) for it, and even when I did figure out a way to post code TextPattern would try to format it.

So, I finally had a reason to learn Django, and here is the product. I even implemented my own syntax highlighting filter (Josh Simpson's idea to do this is actually what finally made me want to switch away from TextPattern in the first place):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from django import template
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
from django.template import Context, loader
from django.template.defaultfilters import stringfilter
import re

register = template.Library()

@register.filter(name='code_highlight')
@stringfilter
def code_highlight(value):
    """ 
        Checks for <source lang='lang'> tags in the article, and runs them
        through pygments for syntax highlighting
    """
    t = loader.get_template('codeblock.html')

    regex = re.compile(r'(<source lang=([\'"])(\w+)\2>(.*?)</source>)',
        re.DOTALL)
    items = regex.findall(value)

    for (all, crap, lang, text) in items:
        lexer = get_lexer_by_name(lang, stripall=True)
        formatter = HtmlFormatter(linenos=True, cssclass="syntax")
        result = highlight(text, lexer, formatter)

        c = Context({
            'code_block': result
        })

        value = value.replace(all, t.render(c))

    return value

There's still a lot of work to do on it, but I'll get the old posts migrated soon.

November 2, 2007

Scott Paul Robertson
spr
Spr: The Ramblings
» Month of Django Tips

James Bennett is going to try to blog everyday for the month of November with a new Django tip each day. Let me just say that the first post is quite good, and I can only hope the rest of the month is filled with such useful information. His blog archives will quickly become an excellent reference.

February 25, 2007
» Lessons in Open Source from the Django project [pycon]

I feel a little bad for just posting these notes. But I think they can be useful for others. These are notes learned about running an open source project from the Django project. Jacob Kaplan Moss - Lessons learned from Django Arguments for

February 23, 2007
» Web Framework Panel notes [pycon]

Here's some notes from the web framework panel at Pycon, discussing various attributes of the frameworks and why python tends to have so many frameworks. Web Framework Panel Discussion led by Titus Brown featuring: * Zope - Jim Fulton * Che