WriteLab Python Style Guide

As an engineer working at a company focused on writing, I feel that style is as important in programming as it is in writing. The primary motivation for a consistent programming style is readability; others should be able to immediately see what your code is doing, which is difficult when people write their code in different styles. Since our server-side stack is primarily Python, it's appropriate that we have a standard for that language. This guide is based on PEP8 with a few modifications (it should still pass the PEP8 linter, though) and is split up into four main parts: formatting, Python conventions, documentation, and refactoring.

Django, Elastic Beanstalk, Apache Config, and Environmental Variables

I have a Django application running on AWS Elastic Beanstalk using Python 2.7. I am using the “64bit Amazon Linux 2014.09 v1.2.0 running Python 2.7″ AMI that Amazon provides as one of the options for Elastic Beanstalk.

You can customize the environment and some other aspects by using a YAML file such as “python.config” in the directory “.ebextensions” in the root directory of the project. If you are unfamiliar with this, Amazon has some good documentation on it here. You can also Google plenty of templates for getting started.

The problem:
I want to be able to customize some Apache settings and use environment variables. These might not sound mutually exclusive at first (and they shouldn’t be) but I had to use a workaround for both of these to function properly. Let’s start with customizing Apache settings.