Tackling performance problems in Django

Launching a product is fantastic fun, but the work doesn’t end there. Once you start to build up a considerable amount of content and gain more users interacting with your system you will need to be on the lookout for areas of poor performance. In this blog post I will explain some of the code-level tools and techniques we use to identify & improve the performance of BOS. Continue reading

Validating email addresses in Python and Javascript

On the BOS2 project we have added email address validation to our survey input fields. To achieve this we initially used Django’s EmailValidator but it has some limitations – noticeably it does not impose a length restriction on the local part of the email address (before the ‘@’ symbol), and it also requires a dot (.) in the domain part (so example@com fails to register as valid when it should). Continue reading

Testing in Django

I’ve been working with a team of developers on the BOS2 project, a new version of our successful Bristol Online Surveys (BOS) service. This completely new codebase is written from the ground up using a variety of tools and technologies many of  which are new to the developers on the project. For myself, I’ve not had any experience of Cassandra before, and aside from some light-touch Plone work in the past this is my first real Python (Django) project that I’ve worked on.

While I’m enjoying the experience, with a background in Java I’ve come to rely on an excellent testing ecosystem which is one of the areas where I feel Django falls short. It’s not that you can’t do what you want with the Django testing framework but (as this blog post shows) it makes you work harder to get there and it’s often easy to fall into traps as you build your tests. I don’t feel we’ve achieved nirvana with our test framework but we’re getting there. Continue reading