Disqus for Python
I'm working on my Django blog app (something Cal Henderson jokes about), but since I'm too lazy to write a decent commenting system, I've been building upon Disqus. I thought it would be nice to separate it from a Django Application, resulting in pydisqus.
This is licensed under the BSD License. As a warning, this hasn't been thoroughly tested yet. Although it’s been decently documented via comments.
Here’s an example (obviously the api keys are not real):
import pydisqus
response = pydisqus.get_forum_list(user_api_key='key')
print response.code # prints the disqus API response. 'ok' is a successful api call.
print response.message # prints the parsed json of all the forums.
# we happen to know that this returns a list of forum objects.
# which the response object parsed and placed into payload.
for forum in response.payload:
key = pydisqus.get_forum_api_key(user_api_key='key', forum_id=forum)
print forum.name, key
# identical to code above
for forum in response.message:
key = pydisqus.get_forum_api_key(user_api_key='key', forum_id=forum['id'])
print forum['name'], key
Download it here (I’ll submit it to pypi when I have some time to test it through my Django App).
I haven’t finished the Disqus App for Django, so that’s not available.
Django Blog Tutoral Completed
If you follow the feed (and don't check the site). All the Django Blog Tutorials have been posted. You can go to Part 4 and download its entirety if you haven't been following it.
For those who may be wondering, I'm digressing from Django for the time being to writing an article on Javascript. Afterwards, I intend on resuming Django tutorials.
Rails and Django
Notice: As with all people, I have a bias. Mostly towards python over ruby. Keep that in mind
Ever since the release of Ruby on Rails, shortly to be followed by Django, programmers always compared the two to determine the ultimate question: "What is better?" But this is purely on personal preference. It's like comparing apples to oranges. People like each for different reasons that can't be summed up for everyone.
Rails and Django were both extracted from other projects, but each project weren't identical. Rails was originally part of basecamp, which is a ajax web application where as Django was extracted from lawrence journal world. Both focused on different parts of the development process.
Rails was initially developed by one person (David Hansson), to be an "enjoyable experience" for creating web-based products. These includes reasonable defaults and a more restrictive design for the user of the framework. This improves productivity by reducing the brain power used for making petty choices (such as where to store source code file x). But like any good framework, if you truly wanted to do it differently, you can with a bit of tweaking. Since Rails was part of basecamp, it is particular efficient at rapid development for user-generated content (not by some admin) and simplifying repetitive and tasks. An added benefit of Rails is its integration of the prototype / scriptaculous javascript frameworks. Although if you don't like prototype, there are implementations for other frameworks in the works. However, due to Rails' erb templates uses functions over just plain html when possible, the prototype integration is much stronger. I feel myself viewing source for my own applications to get ids that Rails generates for custom javascript.
Django was created by three people (Adrian Holovaty, Jacob Kaplan-Moss, and Simon Willison) for "perfectionists with deadlines". This is more of a traditional websites framework. Since Django was born in the media world, where sites and content need to be completed in hours, Django tries to assist in automating as much as possible. Backend admin pages are automatically provided and common data fetching practices are simplified as much as possible without compromising restricting the developer to the confines of the framework. Since Django was designed for outputting content, it's not as efficient for generating Rails-styled user generated application (although still possible). Django's templating system tries to minimize the amount of magic which leads to more manual html code. And as you can expect, it lacks integration with a particular javascript framework. Also, since the Django admin is nearly completed automated, it's more difficult to make changes to the interface and definitely not tailored for end-users. But, the templating system is friendlier to designers who never used a programming language before.
That sums both frameworks up. Which should you choose? If you rather not deal with javascript code that much but intend on using bits and pieces here and there, use Rails. If you have a lot of content to manage (maybe not by you), give Django a whirl. If you have a language preference, go with the corresponding framework, although I strongly recommend to investigate the other language if you haven't already (See "The Blub Paradox" section of "Beating the Averages").