After a longer than planned hiatus, here is the second part of my building enterprise web applications blog post.
Standing on the shoulders of Apps
One of the aspects of django that I really liked when I first came to it was the ability to plug in apps that gave you discretepieces of functionality. Need your users to have an avatar? there is an app for that. You then have the ability to override the templates,wrap the views and even subclass the models to customise the app's functionality without having to branch the code of the app. This gives yougreat flexibility when trying to build new applications. However, as with any selection of open source code, there are some stars and some dead-ends. I've tried to list the apps that I've recently used on a large project to give you a guide:
django-auth-ldap
If you need to authenticate against an ldap server or an Active directory tree, then this app (availble on Pypi) offers a great, easy to
configure way to allow your existing internal userbase to login using your chosen SSO solution. django-sentry
When your dealing with a range of integration points and apps, you need help assessing and dealing with errors. Sentry is
a great app that can aggregate and alert you to issues with your deployed project. You could also have this functionality
with something like Splunk but there is always value in showing live issues to developers as well as systems teams. django-json-rpc
If you need to create ajax interfaces for rich interfaces, django-json-rpc is one of the nicest solutions for creating hooks
for frontend developers to connect to. It works by having a decorator which you use to wrap a view function, automatically
(via a registration function in your urls.py) exposing those functions via a json endpoint and gives you an autogenerated
documented console to try out the functions with. Great for exposing functionality quickly.
django-haystack
Fast becoming the defacto django search app, haystack is that easy and good that it deserves it's reputation. If only installing
and administering Solr on RHEL 5.5 was as easy. In all seriousness, if you need the faceting and power that Solr brings, read up
on installing and administering it on your choosen deployment os. If you're going large scale you can have a dedicated Solr node /
cluster as it talks via xml over http. django-staticfiles
With all these great apps, how do you manage the various static files that come with them? Need seven copies of jQuery? Unlikely.
django-staticfiles (which has now been added to django trunk it's that good), goes through your installed apps and copies all the
media files to one single location which you can then serve all media from. django-mailer
Email is still the most likely way of alerting a user to an event (even though jabber, sms, twitter are faster). The problem with
sending email in django is that if you send an email in a view function, you either have to handle the error there and then or fail
silently, logging the error. With django-mailer, you can queue the mail, using the current EmailBackend and then handle resending failed
mail asynchronously. Non-django python libraries suds
If you have to integrate with a .net webservice (a SOAP service to the rest of the world), suds is brilliant. It abstracts the painful
SOAP xml, giving you a python object to deal with. It's a great moment when you can integrate a .net webservice into your project in
less time than drinking a cup of coffee. We used suds to create a django utility library exposing certain functionality behind a simple
api. Be aware of security here though. If your organisation has deployed Kerberos correctly, you can for view functions, take the krb5
token and pass it backwards. If not, you're going to have to write a decent delegation framework, which allows your app to perform
operations on the user's behalf. A great idea that we didn't use was to use oauth (as used by Twitter, Facebook, Google, etc) and have
users allow your application to perform certain actions on their behalf. There are .net libraries for oauth 2.0 as well so you would
have to have a bridge but worth looking at. pip
Pip is a great package management system for python, which when combined with virtualenv is a winner for repeatable installations. The
particularly useful aspect is the ability to freeze the current packages in site-packages creating a requirements file which you can
pass to pip to create a completely identical setup. It's not as fully featured as buildout but no where as complex as buildbot.
