Skip links

Jody Boucher

Software Engineer

Blog

Django Middleware: An overview of middleware

The Django web framework contains hooks enabling a global mechanism for modifying the request and/or response in between the web-server interface and the view. Django middleware are the components that make use of these hooks.

An example of Django middleware is a component that adds a user attribute to each incoming HttpRequest.

This post provides an overview of middleware in the Django web framework.

[Read more…]about Django Middleware: An overview of middleware

Django How-To: Using the null and blank field options

Django logo

Models typically make up the foundation of most Django projects. They are the primary abstraction for managing the data/state that is the core of most "applications". Models not only define the structure of the database, each model is the mechanism for accessing and modifying the data stored in the database table represented by the model. Models are also generally responsible for any behaviors of the data and for validating data to protect the quality of the data in the database.

The most obvious part of any Django model is the list of fields. Each field in a model is related to a column or attribute in the database table associated with the model. Fields have two options that can be confusing to many developers that are new to the framework. The two options are null and blank. Although the two options might seem to address similar functionality, they are used for very different purposes.

[Read more…]about Django How-To: Using the null and blank field options

Django project layout alternatives

Django logo

Laying out and organizing a development project (Django or otherwise) is a task to which many people do not give much consideration, typically deferring to some default layout. This default layout is usually obtained in one of several ways:

  • using Django's admin tool (django-admin.py startproject) to create a new project
  • copying an old project and using it as the basis of the new project
  • cloning a project found on GitHub or elsewhere and stripping it down to its bones

Most developers won't stop to think about the project layout and whether a different alternative may work better. Many don't even realize that there are different ways you can layout a Django project.

[Read more…]about Django project layout alternatives

Setting up HTTPS with Let's Encrypt

HTTPS success!!! SSL Labs test report for jodyboucher.com

In the previous post I provided a brief overview of Let's Encrypt, a service (currently in public beta) intending to expand the use of HTTPS by providing free certificates and a client to automate most of the work involved with obtaining, installing and renewing the certificates. In this post I step through the process of using Let's Encrypt to set up HTTPS on this site.

[Read more…]about Setting up HTTPS with Let's Encrypt