sdjournal


Home » Archives » Posts in Python

Saturday, 20th August 2005

Exhedra: a conferencing/forum application in Django

I've recently started some development on the Exhedra project (a conferencing/forum application) using Django. For anyone reading this post on SDJournal, the posts from this category are also syndicated on the Django Community page. Rather than clutter up that page with multiple posts about this project I've set up a separate weblog to cover it.
06:35PM in Django Exhedra

Monday, 25th July 2005

Django IRC logs to the rescue

The 2nd Django tutorial starts with getting the admin interface up and running by creating an initial user account and using the built in development web server. However, after following the instructions quite closely I was still getting Tried all URL patterns but didn't find a match for /admin when requesting the admin URL. A search of the IRC logs for #django revealed that for it to work the settings module must be set to .admin so if you're using myproject.settings.main for the working with the model in the first tutorial you'll need --settings=myproject.settings.admin.
10:12AM in Django

Sunday, 24th July 2005

Getting the Subway Noteboard example up and running

After taking a first look at Subway a few weeks ago I've been doing a bit more work with it today in terms of getting the NoteBoard example app up and running.

I already had some of the dependencies installed (Python 2.4, Cheetah 0.9.17, MySQL, mysqldb) so I needed:

and then it was just a case of getting the latest version of subway itself.

These all install using the familar python setup.py install approach. After that the example can be started up by going into the examples/noteboard directory and running python scripts/start_server.py.

The one thing that did catch me out at first is that some of the .html templates are saved with CRLF line endings and these needed to be converted before things would work correctly under Linux. (this is mentioned in this posting to subway-devel.) The symptoms for this were receiving a from site import site ImportError: cannot import name site when trying to request the root page for the app.
04:07PM in Python


Wednesday, 20th July 2005

Django Framework

Django is a Python web application framework. It's been developed and used over the past 2 years to run a number of online news sites such as lawrence.com and LJWorld.com. It has recently been made available under a BSD license and already a community is building around it. It seems to be focused on automating as much as possible and adhering to the DRY principle.

Looks like Adrian Holavity and Jacob Kaplan-Moss are the guys behind it.

Update: From the FAQ, the other Django developers are Simon Willison (whose weblog I've been reading for a long time) and Wilson Miner.
10:05PM in Django (via The WELL software conference)


Monday, 7th March 2005

OnDemandAmazonList

Leonard Richardson recently emailed me a copy of OnDemandAmazonList, which can be used in conjection with PyAmazon to iterate over the results of an Amazon search as though it were a normal list.

Normally it's necessary to fetch the results from Amazon in batches by specifying a different value for the page parameter. Leonard's class abstracts this away by returning you results one at a time via the iterator's next() method which silently fetches the next lot of results from Amazon on demand as required.

This class can be downloaded from the Contributed Code section of the PyAmazon page.
12:31AM in Python pyamazon


Friday, 1st October 2004

PyBloglines

I've put together an initial version of a Python module for accessing the Bloglines Web Services. Details and downloads are on the PyBloglines project page. You'll need a copy of Mark Pilgrim's Universal Feed Parser, which is used when you get items.

Usage is:

from pybloglines import BloglinesWebServices
# password is optional if you're only calling update() to check unread count
bws = BloglinesWebServices("user@example.org", "password")

To a count of the unread items for the user:

unreadCount = bws.update()

To get a list of subscriptions:

feeds = bws.listsubs()

This is returned as a list of Subscription objects where each entry has title, htmlUrl, type, xmlUrl, bloglinesSubId and bloglinesIgnore.

for feed in feeds:
    print feed.title

Get the items unread items for a feed, not marking them as read:

feedData = bws.getitems(bloglinesSubId)

What you get back is the result of passing the RSS returned by the BWS getitems call through feedparser so see the documentation for details on the structure.

07:11AM in PyBloglines Python

The Python Grimoire

Python Grimoire:
« The Python Grimoire explains how to perform common programming tasks in Python. It is a good place to go after you've read the Python Tutorial and have a reasonable grasp of the basics of the language. »
08:01AM in Python (via dive into mark b-links)

Sunday, 14th March 2004

A Byte of Python

For online books on Python, as well as Dive into Python there's A Byte of Python
05:13PM in Python (via torrez.org Daily Notes)