Hi, I'm Harlin and welcome to my blog. I write about Python, Alfresco and other cheesy comestibles.

Python + Gunicorn + Nginx - A Simpler and More Performant Method to Deploy your Django Projects

Last week, I posted an article that had to do with hosting your Django projects with gunicorn and Apache. Today, I want to mention an alternative to Apache called Nginx. Most of you know that Apache is probably the most used web server on the planet and has been around ...

Read More

Python + Gunicorn + Apache - A Simple and Performant Method to Deploy your Django Projects

Note: This is not a discussion about Apache being better than its competitors. It's only about how to set up Django, Gunicorn and Apache.

I used to host my Django projects with mod_wsgi and Apache. It worked well for most things. Some of its advantages are that it's ...

Read More

Python + Django How to Test Views

Today I wanted to go over how to use Django's web client testing features. It's a fairly simple thing to grasp how to use Python's unit testing to test functions and procedures but I am finding that a lot of Django beginners are not sure how they ...

Read More

Python + Django - How to use the built-in authentication system

In this article I want to show you how to use the built-in authentication system that Django provides for you out of the box. You could build your own authentication functionality into a view by doing the following:

  1. Check to see if the request.user is authenticated.
  2. If the user ...

Read More

Python - How to Set Up a Simple HelloWorld Django App

The purpose of this post is to provide a set of instructions to create a simple helloworld app in Django. This app can then be used for testing purposes in other posts I've written.

Set up virtual environment:

# pyenv global 3.6.4
# pyenv virtualenv deploy_django
# pyenv local deploy_django ...

Read More

Python - How to Group Imports

In case you were ever wondering, here is the standard way to group your imports.

# Standard library imports
import os
import sys

# 3rd party modules
from django.http import HttpResponseRedirect
from django.shortcuts import render

# My project-wide modules
from blog.settings import THEME
from lib.util import get_http_referer

# From separate ...

Read More

Python - Understanding Querying in Django

If you're an old guy like me, you are probably used to SQL queries. You can certainly use them with Python to retrieve data from RDBMS servers but they can be a little problematic for a number of different reasons. They can be difficult to implement without writing a ...

Read More

Python - Simplest Django Tutorial Ever

I wanted to write up a very simple Django tutorial that will show you the workflow behind creating a very simple CRUD app. The workflow is repeatable of course. You can use it to build more functional apps.

The steps below will show you how to build a simple ToDo ...

Read More