getting started with sinatra and postgres web service

I'm in the process of resurrecting some of my past projects. One of them is a web service that provided details for a given zip code. For example, you could lookup the zip code '15213' and the web service would spit out the geographical center for the zip code (i.e., the latitude and longitude coordinates), as well as the city and state for that zip. I originally programmed the web service using Ruby on Rails, but using RoR for a relatively simple API is a bit overkill. So I decided to use this project…Read more …

flock 2014

I recently got back from my trip to Flock, held in Prague, Czech Republic. This is the first Fedora conference I've attended and, while the memories are still somewhat fresh in my mind, I thought I'd jot down some of my thoughts & reflections about the event. I arrived the night before the conference and was pleasantly surprised to find that getting to the conference venue was pretty easy. Prague's public transit system is extremely convenient - the metro, bus, and tram system are all integrated and tickets are very affordable. Buses from the…Read more …

404 and 500 errors in django

Problem: Server Error 500. In the server log, all it mentions is a line that looks something like "GET / HTTP/1.1" 500 27 Potential fix: There are two potential reasons for this error. Ensure that ALLOWED_HOSTS is configured properly in the settings file. In the default settings file, there's a line for ALLOWED_HOSTS=[]. In my case, I was deploying things locally, so I edited this line to be ALLOWED_HOSTS=['127.0.01','localhost']. If you're deploying things on a specific domain, list that here. Others have suggested using ALLOWED_HOSTS=['*'], but this setting should really only be used for testing deployments, as it's not…Read more …

getting DEBUG=FALSE to work correctly

Problem: Static resources (images, js, css, etc.) lead to 404 errors. Potential fix: A similar question was posted here and here. This is actually by design, as django is not meant to server static resources when DEBUG=False. Basically, when you're in DEBUG mode, static files are being served via the staticfiles app (which uses settings like STATICFILES_DIRS and STATICFILES_FINDERS to properly locate your static resources). When DEBUG=FALSE, the staticfiles app doesn't run and your static resources aren't being referenced correctly by the django webserver. However, if you were to host the files are…Read more …

django + less, updated

In a previous post, I described how I configured the hyperkitty django project to use LESS. Briefly, my steps were: - install django-compressor, django-less, nodejs, npm, and lessc - update settings.py with configuration settings for django-compressor and django-less - restart webserver However, it turns out some of those steps are a bit outdated. First, PyPI says that django-less is not maintained and suggests using django-static-precompiler instead. Second, while LESS suggests that the easiest way to install the compiler is via npm, it is just as easy to install the LESS compiler via nodejs-less.…Read more …