This may be common knowledge for folks who are much more versed in Django than myself, but here’s a short post of something I ran into today with a web application of mine that’s using Django.
Checking my website out in Google’s Webmaster Tools I noticed that it’s report on my sitemap.xml file contained a “Redirect error” warning because some of the URLs contained in my sitemap returned a 301 HTTP status code. This “error” apparently caused the Google crawler not to crawl the links on the pages that returned a 301 response (I assumed this because in the Webmaster Tools my “Pages crawled per day” numbers were significantly lower). Obviously not good for SEO efforts.
Doing a little searching online, I found that in the default Django setup the APPEND_SLASH setting from the CommonMiddleware plugin will (as it’s name implies) append slashes to the end of requested URLs if it’s not present, however this functionality redirects the visitor to the URL containing the trailing slash and returning a 301 response. The URLs in my sitemap.xml file did not contain a trailing slash.
Wanting to keep the settings in the application as close to default as possible, I simply edited my sitemap.xml file making sure my URLs had trailing slashes and the Google crawler balked no longer.
My “Ruby Programming Challenge For Newbies” Efforts
One blog that I subscribe to in my RSS feed is RubyLearning Blog. Since September of last year, they’ve been posting (approximately bi-weekly) programming challenges for newcomers to Ruby appropriately named Ruby Programming Challenge For Newbies.
Outside of the class I took at Sierra College and a couple Rails projects I’ve thrown together on my own, I haven’t really had as much time with Ruby as I’d like. With the day job having been a bit slow lately and not wanting to risk getting in trouble for doing outside contracting work while there (and assuming learning/training is an acceptable way to pass time), I decided to do the past exercises as a way to further my proficiency with the language.
Here are what would have been my submissions for the first five contests:
http://gist.github.com/283194
http://gist.github.com/284044
http://gist.github.com/284303
http://gist.github.com/284365
http://gist.github.com/284408
Though my version of the solution aren’t the most elegant or Ruby-like, having worked out the exercises on my own then reviewing other people’s entries was extremely beneficial, showing me even slicker ways Ruby can be used to solve problems.
I’m really looking forward to the next contest and actually submitting my entry for review.