Django, Wikis

Over the last couple of weeks, I’ve been trying to code up a news aggregator that works the way I want it to. That meant I had to decide what I was going to use to develop it.

I thought about what I like, and read about a few different web application frameworks. A few things I was thinking when I chose to give Django a try:

  • I prefer liberal open source licenses (MIT, BSD) to copyleft ones (GPL).
  • I want Python or Ruby. Of the two, I prefer Python because it has less syntax and more libraries coded for it.
  • I like PostgreSQL. It has some cool extension libraries (for mapping and other domains) and a liberal license.
  • I want something that’s proven
  • I want something that is very actively being worked on
  • Not having to write any SQL at all for simple sites is a plus.

I thought about web.py, Rails, Turbogears, and Django. I also thought about Python servlets or writing my own framework.

Things that impress me about Django, besides meeting my above criteria:

  • The template system. It has its own template system that supports “Template Inheritance”, which is a very neat concept. It also plays well with Dreamweaver, they say. I haven’t used Dreamweaver so I’m unable to confirm that.
  • The admin interface. It’s a bunch of code that comes with Django to provide a nice admin screen. In the program I’m making, if feeds become corrupted I could go into the admin and fix them. Or I could just have a good look at the data
  • The configuration files, including regular expressions for URLs.

I set to work installing it, and decided to document how I did it in a Wiki. For this, I installed Instiki, which is an impressive program. One thing I like about it is the fact that it supports three different wiki languages. I chose Markdown, which is not the default. I expected that since it was not the default, the support would be very rudimentary. I was pleasantly surprised! It’s supported and documented every bit as well as TextPattern, including a quick reference on the side of the editing pages.

After I figured out how to get a kick-ass Django development installation on my iBook, I decided to share my knowledge with others. The best place to post the information, I determined, was on the Django wiki. The wiki, as it turns out, is powered by Trac. It has its own wiki syntax that is similar to wikipedia.

After a search for translation tools, I started manually converting what I’d written to Trac’s wiki format. This was tedious, so I wrote a script to help out. After that I searched around a bit more, and found that Aaron Swartz wrote an html2text that converts from HTML to markdown syntax. What a great idea! First, Markdown looks good in plain text format, since it was designed to use the same idioms that people use when sending plain text e-mails. Second, it can be used to go from any wiki format to Markdown. This is because in order to display pages wikis convert from plain text to html. So all you have to do is go into view source in any wiki, copy the segment of the wiki you want, paste it into a text editor, save it, and run Swartz’s html2text on it, and voila, you have converted from that wiki format to Markdown.

If I get around to writing a serious tool to help me translate from Markdown to Trac, instead of just writing something to go between the formats, I’ll write a script to convert from HTML to the Trac wiki syntax.

One Reply to “Django, Wikis”

  1. Ben, I’d be _very_ interested in a tool to convert Markdown to Trac’s WikiFormatting. It’s been a pain in the butt for me to keep two versions of wiki pages; I create and edit in Markdown locally, then have to reformat it for the wiki pages. Being able to write once and use it everywhere is what would be ideal!

    Maybe another idea would be to ask Trac if they support alternate formatting (such as Markdown or Textile) as a third-party add-on to a Trac instance.

    Aaron’s html2text looks cool, thanks for the link.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.