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:
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
No comments:
Post a Comment