When Django Met IIS

The Problem:

The county I work for had a one page geography quiz with outdated questions and a poorly structured user interface. It was just an unstyled list of select dropdowns and a submit button. The answer page that was returned just listed each question with all the answer choices under them. One answer under each question was highlighted in yellow but it wasn’t made clear to the user whether this was the correct answer or just the answer they chose.

Old Mesa County Quiz

The old county geography quiz left a lot to be desired.

To compound things, the quiz was stuck in an enterprise CMS that gave it a really ugly url. I wanted to change that so it would look good and be really easy to understand. Thankfully I wasn’t restricted to any particular language or technology stack to build the new quiz.

The Solution:

A few years back I had played around with Django and thought it was a cool framework but I had never really applied it to any project. So I said to myself “why not?” and set out to build a new geography quiz app with Django. Over the next couple of days I put together the components of the new application:

  • A PostgreSQL database to store the questions and answers
  • Models to define the data in the database
  • Views to process and send the data and to route user answers to the answer page
  • Templates to render the data

Everything seemed to be going along smoothly although I wasn’t very happy with the way I wrote my views to handle the user submitted answers. The app basically builds a form on the fly (questions with radio button answers) then does a POST when the quiz taker clicks the submit button. The view then takes the POST data and turns it into a Python list. The rest of the view just slices and dices the list and uses offsets to pull out the matching questions and answers.

I know there are cleaner ways of doing this. Especially since the returned POST data is a querydict object which is basically just a Python dictionary. Manipulating key/value pairs seems neater. But the way I did it worked and I got it up and running fast. Maybe a project next time I’m bored will be to make the code cleaner and more maintainable.

Another Problem:

Remember earlier when I said that I asked myself “why not?” when considering using Django? Well, I was about to answer that question and the answer wasn’t pretty.

While I was developing my quiz app I used Django’s built-in server which is a lightweight “please don’t use in production” server. It worked great. Then I decided it was time to port the app to my production server and actually use it in the real world. At that point I remembered we use IIS on a Windows server.

IIS isn’t all bad, especially if you work in a place that uses .NET components heavily which I do. Unfortunately, Django was never really developed to run on IIS. Django was really designed to live in a Unix world and be served out with something like Apache. I remembered that from my prior experience with the platform – I just forgot.

Another Solution:

There are several tutorials on the web (most of them several years old) that discuss running Django under IIS but none of them were very straight-forward. The solution that seemed like the quickest route to a running app was to use Helicon’s Python Hosting Package (part of the Helicon Zoo repository available through the IIS Web Package Installer). The hosting package basically loads all of your dependencies and does all of the complicated work of getting IIS to run an antagonistic technology. You then load a Python Project module which builds everything for you including:

  • A virtual Python install specific to your app
  • A web config file with needed environment variables
  • Permissions and application pool settings

The only pain point I had with using Helicon’s solution was discovering it doesn’t work with Django 1.7. I had developed in 1.7 and then when I migrated into the Helicon environment everything broke. This really threw me for a loop for a while until I found a post suggesting using Django 1.6. This didn’t turn out to be a big deal as it didn’t affect my apps functionality. I just had to remove a couple of middleware classes from my settings file and I was good-to-go.

New quiz

The new quiz is cleaner and more modern


I love working with Django. If I wasn’t in a Windows environment I might be trying to use it throughout my office GIS site. But I can’t see trying to force uncommitted technologies into a relationship they don’t even seem to want. I guess Django is just going to be a hobby framework for me for now. Fortunately there are plenty of others out there just waiting to be learned and implemented.

Brackets – My New Favorite Code Editor

bracketsA couple of months ago I started searching for “the best” code editor for web development. I wanted to see what was out there and how it compared to what I have used and was currently using.

Since most of my co-workers live in the .NET world I have access to Visual Studio, which I actually like as an IDE. I’ve used it to do a good deal of development over the last couple of years. But I wanted to explore more of what was out there for code editors that might be more lightweight, fun and available wherever I might want to use it (work, home, on the road…).

For web and desktop work at home I’ve used Notepad, Notepad ++ and Aptana and have never been really happy.

Notepad ++ actually works really well but I hate the interface (it’s boring and ugly rolled into one). Besides, it would be nice to use something platform independent for portability. On the plus side (sorry), in Notepad ++ you can configure styles and keyboard mappings and there;s a lot you can do with the preferences to make things work the way you want them to.

That’s actually the story with the majority of editors and IDEs out there today. Most of them have customizable settings and functionality either built-in or available through plug-ins or extensions. Some of them are geared toward specific languages or uses but most of them seem to handle the most common languages.

No Magic Bullet

I’ve come to the conclusion that there is no “best” editor. There are only ones with fewer annoyances than others. Out of the editors I have been trying lately there are a few I have only used for a few seconds (like Atom) and some I’ve done some heavy lifting with (like Sublime Text). My favorite so far has been Brackets, the open source project from Adobe.


I really like the look and feel of Brackets. It has a nice flat design. It doesn’t overwhelm you with controls and menus. But that led me to pause and question – where are all the controls and menus? It turns out, a lot of your customizations are done directly through json files or through extensions. That’s great because I love working in json.

Changing the keymap is not as straight-forward as most code editors and IDEs but it is intuitive and simple. You just have to override the default mappings in the keymap.json file. I set up my block and single line mappings because the defaults almost always annoy me.

I’ve been using Brackets both at work and at home. In my home setup I use the live preview feature all the time. It’s only available through Chrome which is not a problem for me. I usually like to debug my HTML, JavaScript and CSS in Firefox (Firebug) but the Chrome developer tools work just fine for most things. Live preview is great because the Chrome page refreshes automatically every time you save your HTML file. I have a different setup at work which doesn’t allow for the live preview to work but I might be changing that soon.

Brackets really shines with its extensions manager. This is where you can install/uninstall user created extensions or Brackets themes. You can also search Github for extension, download the zip file and drag the zip right into the extension manager. It only took a few minutes to search for and install a few extensions to make development easier. These included Grunt, indent guides, code folding and code beautification(formatting).

I have notices some of the extensions can slow Brackets way down so that’s something to watch as you’re loading new ones up. Now I’m just looking for a reason to create an extension of my own or some reason to hack Brackets itself.

Shapefile as a Multi User Editing Environment?

I had a ArcGIS user that I support come to me with a corrupted shapefile the other day. It had the old “number of shapes does not match number of table records” error. It turns out, he’s still using this shapefile as his layer’s main data source and he and several others regularly edit it! In this day and age?120px-Face-surprise.svg

I tried to convince him using a file geodatabase would be more stable for editing but he had been using shapefiles so long I don’t even think my comments registered. He just wanted a tool that could fix the shapefile.

I pointed him to the shapechk tool by Andrew Williamson. I’ve used the tool for years because <sarcasm>for some odd reason</sarcasm> I often run into people with corrupted shapefiles after people edit them over long periods of time. The shapefile works OK as a data exchange format but doesn’t always hold together under regular heavy use.

well duh garfield photo: Well duh Garfield wellduh.jpg

In the words of Pete Seeger, “when will we ever learn?”

Are Linkedin Background Photos Worth the Trouble?

InBug-60px-RWith Linkedin allowing background photos for your profile you now have one more way to express yourself creatively on the platform. But Linkedin isn’t Facebook. It’s a professional network and is typically understood to have professionally presented profiles. Having a clean, flat layout with a simple blue and grayscale color scheme has helped keep Linkedin profiles in line with that strategy.

Before background photos the worst offense a user could do visually was insert Homer Simpson as their profile picture. Now we are given the power to screw up a much larger portion of our profile’s real estate.

Is it worth possibly reducing the professional look of your profile just to “express” yourself on one more social channel? Or is it worth the time and effort it will take to produce an image that will still project the professionalism that a plain background already does? The answer to both of these questions is – probably not. I doubt that a connection, employer or recruiter will give a second thought to your profile header not having some sort of graphic behind it. A good head shot as your profile picture will, however, still be expected.

But that doesn’t mean that you absolutely shouldn’t use a background photo. If an image is well thought-out and conveys important information upfront to someone viewing your profile, it could be very worthwhile. Putting in a picture of balloons, sunsets or your dog will probably only serve to distract viewers. However, a picture of you speaking at an event gives the impression that you’re an expert in your field and have experience with public speaking. Likewise, a picture of a map might strengthen the profile of a cartographer or GIS professional.

When someone views your profile, your title and profile picture are usually the first things they see. As we all know, first impressions can make a real impact. If you can influence that first impression positively, then the extra profile eye-candy could be an asset.

I’m still on the fence about whether to put a background photo on my own Linkedin profile page. At this point in time I think Linkedin background photos are a bit of a risk for both Linkedin and its users. While profile customization can make your page look nice, it also runs the risk of making it look like a wannabe Facebook page. That’s not in keeping with the feel of Linkedin. If you do decide to add a background photo, keep it simple and above all, relevant to the rest of your profile.

C is for Crash

There are those moments when you realize that certain sports just aren’t worth it.

c is for crash_cropped

I spotted this sign while hiking a local ski resort in the off season. I wonder how long it took for someone to realize that instilling terror in your patrons isn’t a good marketing ploy.

Installing Setuptools and PIP for Python

python-logo-master-v3-TM-flattenedI’ve installed a lot of Python packages over the years using Distutils, SetupTools/easy_install and PIP. Distutils is Python’s built-in package distribution module and is pretty easy to use. However, it has some limitations, primarily that you have to manually download the package dependencies and there is no method to uninstall packages.

The Setuptools easy_install script takes care of downloading packages and package dependencies but still lacks certain features you would want from a fully functioning package manager. It doesn’t provide version control support, package tracking and uninstallation. There is a lot more to the Python package discussion but there is no point in bringing it up.

Anyway, while I use package distribution tools I rarely have to install the tools themselves since they only get loaded once. When I do have to set up a new machine or upgrade someone elses, I always forget the steps to get Setuptools and PIP installed. So I thought I would document the steps here. Now I just have to remember to come back here when I need them.

 Installing Setuptools:

1. Right click on this ez_setup.py link and save the file to your Python Scripts folder (If you have ArcGIS loaded you will usually find this at C:\Python27\ArcGIS10.x\Scripts).

2. Open a command prompt and change into the SCRIPTS directory.

3. Type

then hit enter to execute the code. This will run the script which will download and install setuptools on your system.

For the official installation instructions for setuptools, which includes instructions for installing on Windows 8 with Powershell visit https://pypi.python.org/pypi/setuptools.

Installing PIP:

1. Open a command prompt and change into the C:\Python27 directory.

2. Type

then hit enter to execute. Pip should now be installed on your system.

To actually install a package using PIP from a command prompt you simply type

and everything will be taken care of for you. To explore the more than 54,000 packages that are available for Pip to load visit PyPI – the Python Package Index.

Be Different with Custom Styled Google Maps

map style by Tracy Elliott on SnazzyMaps.com

If you are developing with the Google Maps JavaScript API you’re already creating custom code so you might as well go the extra mile and change the default style of your map so it doesn’t look like every other Google map out there.

Getting a unique looking map that fits well with the style of your web page is actually really very easy. The Google API gives you the option of re-styling the existing standard map types or creating new map types containing your styles. Either way, if you are comfortable with the Google Maps JavaScript API you can put a fresh face on your map in no time.

For detailed instructions on how to custom style your map, you can see the Styled Maps section of the Google Map JavaScript API Developer’s guide.

If you would rather use a tool to generate your code you can use the ones listed below for free. Some of them even have pre-built styles that are ready to be plugged into your code.

Styled Map Wizard

Evoluted Style Tool



Google Maps Colorizr

Custom Google Maps Style Tool


Tourist Pine to Fly Drones in Antarctica? Weird!


The International Association of Antarctica Tour Operators is cautioning all potential travelers to Antarctica who pine to fly a drone to check with their travel agent or tour operator before packing their device.  – The Washington Times

Tourists are pining to fly drones in Antarctica? What kind of tourist pines to fly drones in Antarctica? The bigger question is who uses the word pining anymore?

Is IE on its Last Legs?


Tidings of a new browser coming from Microsoft have some wondering whether Internet Explorer is on its last legs. The sad news is that there are still so many old  versions (7, 8 and 9) IE sitting on millions of computers, and their users don’t know any better. So even if Spartan, or its children, eventually displace IE, front-end developers will be playing pattycake with old IE versions for years to come.

It’s interesting that Microsoft is coming out with a brand new browser when IE11 has so many improvements and seems much less maligned than its older versions. Makes me think maybe this is just the start of a rebranding effort.


Further Reading:


Map your business

Believe it or not, maps aren’t magical. They don’t just happen. Online mapping companies like Google, Microsoft, Apple and MapQuest get data on their maps through good old fashioned research. But there is a limit to the amount of information they are willing to collect and display by default.

Fortunately, if you’re a business owner you can help make online map applications more complete while increasing your business’ exposure. The four companies listed above all offer free services for verified businesses to be able to update the information presented on their maps.

If you own a business you owe it to yourself to research your own map listings and update them if you don’t like what you see. Here are the links so you can get verified and start updating now:




MapQuest no longer supports accessing your basic listing information through their Local Business Center. You can add your business listing to MapQuest but you can only submit limited information. In order to enhance your listing you need to upgrade to a premium account.