Saturday, 20th August 2005
Monday, 25th July 2005
Django IRC logs to the rescueThe 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.mainfor the working with the model in the first tutorial you'll need
Sunday, 24th July 2005
Getting the Subway Noteboard example up and running
I already had some of the dependencies installed (Python 2.4, Cheetah 0.9.17, MySQL, mysqldb) so I needed:
- latest sqlobject out of subversion
- latest FormEncode out of subversion
- CherryPy 2.1 beta from sourceforge
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
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.
Wednesday, 20th July 2005
Django FrameworkDjango 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.
Monday, 7th March 2005
OnDemandAmazonListLeonard 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.
Friday, 1st October 2004
PyBloglinesI'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.
from pybloglines import BloglinesWebServices
# password is optional if you're only calling update() to check unread count
bws = BloglinesWebServices("firstname.lastname@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:
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.
The Python GrimoirePython 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. »