Monday, January 30, 2006

It's A Boy!

ultrasound profile picture

In case you hadn’t heard, Ily is pregnant and due on June 29th. We had The Ultrasound today, and the anatomy was clear, it’s a boy. Isaac has declared that we will name him Jacques. We’re not so sure, but it sounds like a good fetal nickname to us. The full reality of having three little boys running and wrestling around the house is still sinking in. It should be fun, right? :-)

Click on over to the photo album to see Jacques’ first baby pictures.

Posted by Bryan on January 30, 2006

Sunday, January 29, 2006

Website Updates

It’s been a long time, but I’ve rewritten this website to make it a whole lot easier to update and maintain. I’ve added new features, like different news topics, the ability for you to comment on news items, and news feeds (The BBC explains these pretty well actually). I’ve been feeling like I should write more stuff down, so maybe this will help.

Saturday, January 28, 2006

How to Build a Django Powered Blog

I just about started using Wordpress, but I’ve been really
intrigued by this Django
thing, so I decided I’d rather mess around with it than Wordpress and
it’s PHP-ness. Roughly, this is what you need to do to build this
site:

Install Django

django-admin.py startproject yourproject

add admin to your installed apps in settings.py

python manage.py install admin
python manage.py createsuperuser
svn co http://code.djangoproject.com/svn/djangoproject.com/

copy the blog app from the djangoproject.com project
to your project’s apps directory

add a categories class to models/blog.py

move blog/urls/blog.py to blog/urls.py, rm -rf blog/urls/

add it to your installed apps in settings.py

Add this to your urls:

(r'^', include('murdockfamily.apps.blog.urls')),

Edit the first url in blog/urls.py so the slug regexp
is [\w-]+ instead of just \w+ (by accident I
discovered that the slug field accepts the '-' character,
but the regexp for the slug urls didn’t.

python manage.py install blog

break copyright law:

copy the blog templates from djangoproject.com to yourproject/apps/templates/blog

cp djangoproject.com/django_website/templates/base_weblog.html yourproject/apps/templates/blog

in yourproject/apps/templates/blog:

perl -pi -e 's|(extends )"(base_weblog)"|\1"blog/\2"|' *.html
cp djangoproject.com/django_website/templates/base_2col.html yourproject/apps/templates/blog
perl -pi -e 's|(extends )"(base_2col)"|\1"blog/\2"|' *.html
cp djangoproject.com/django_website/templates/base.html yourproject/apps/templates/blog
perl -pi -e 's|(extends )"(base)"|\1"blog/\2"|' *.html

add django.contrib.comments to your installed apps

add comments urls and comments_info_dict to your urls

copy comments templates to yourproject/apps/blog/templates/comments/

do the above “base” search and replaces again

in the templates dir, do this:

find . -name "*.html" | xargs perl -pi -e 's|weblog/||'

also, remove "weblog/" from the get_absolute_url method in the blog.py model

python manage.py install comments

feeds:

copy from main.py:

from django.contrib.comments.feeds import LatestFreeCommentsFeed
from django_website.apps.blog.feeds import WeblogEntryFeed

to your urls.py, change django_website to yourproject

rename stuff inside blog/feeds.py

add the rss url from main.py

add the feeds dict

kill the community line from the feeds dict

Something is still not working…oh comments rss sort of works, has
example.com in there a lot. Fix this later.

python manage.py runserver

go to http://127.0.0.1:8000/admin and add an entry

go to http://127.0.0.1:8000/

(change the templates before going live with this)

Still Todo:

Further enhancements (oh the fun could never end):

create templates for feeds for all posts and comments so description contains the full text

create feeds for each category

aggregate photo album in some cool way

a url and email field for comments, like wordpress does

ping all the cool blogging sites, like wordpress does

ability to write posts in emacs

format posts with one of those markup languages django seems to include

pingbacks or trackbacks or whatever