Grant Jenks Logo

Emmaus House Food Pantry Service

While living at Emmaus House in downtown Atlanta, my wife volunteered in service of their food pantry program. When she arrived, there was no system for managing the food pantry and she soon asked me to develop a simple inventory system. As I’ve been learning Python and Django, I thought an inventory system was the ideal CRUD application. The best way to learn is by doing and I’m excited to see this used in practice.

I’m releasing the source code for the food pantry inventory system under the MIT License on Github . I welcome you to fork and contribute to the project.

Features

Two features are worth highlighting. The first relates to data input. Most of our food pantry items carry typical bar codes that are used by supermarkets at checkout. The interface is designed to support barcode scanning using a modern USB-connected scanner. The mechanism to get this working is actually fairly easy. After connecting the barcode scanner, it registers itself as a keyboard-like device. When a barcode is scanned, it produces a string of characters followed by the enter key. In a web interface, it’s simple to bind to the enter key press and then parse the input characters. After entering the details of an item the first time, future scans lookup the information in the database and speedup the scanning process.

The second feature relates to deployment. Unfortunately, the office where the food supplies are kept lacks an internet connection. Wanting to use a web browser for the front-end, I knew that I would need to host a web server on localhost. This also meant that deploying the application and updates would mean more than sharing a url and refreshing the page. Fortunately, py2exe is a wonderful project that supports packaging the Python runtime and supporting files into an executable. This mechanism is a bit more complex.

My Django application requires source code and static files for template rendering. While packaging source is clearly understood by py2exe, static files is a little more tricky. And getting all the environment variables right during deployment was even harder. Eventually, I gave up trying to use the built-in source and static file management tools. Instead, I use py2exe to deploy a script with a large zip file embedded in the executable. When the script starts (from the executable), it pulls the zip file out and extracts it to a temporary directory. That zip file contains the entire Django application, source and all. Once extracted, you need only set the application root and start the web server. Read the web application script for all the gory details.