Blogable Thoughts Everything from the web to the mountain. Our thoughts.

Thoughts on Django Template Setup

Some interesting ideas on an easier base template setup inside Django sites.


{% block js-head %} Tags that need to go up top  {% endblock js-head %}

{% block header %}  Header {% endblock header %}

{% block body %} Body goes here {% endblock body %}

{% block footer %}  Footer {% endblock footer %}

{% block js-foot %}  All other javascript goes here {% endblock js-foot %}

This setup allows for easier management of static assets like JS and CSS files. 

Keep Reading...

Google Maps GeoCoder in Django

Some recent work called for a model that was able to show a location via the Google Maps API. The location needed to be entered in the admin and I felt the most user friendly way to go about this was using Google's geocoder (street address to lat/lng coordinates).

Here is how I went about it in my model:

from app.helpers import get_lat_lng

class Location(models.Model):
    address1 = models.CharField('address', max_length=255, blank=True)
    address2 = models.CharField ...

Keep Reading...

Cooper's Adventures

Say hello to the Cooper's Cabins team's newest endevour. Cooper's Adventures. The site is under contruction and will be up in the near future.

Check it out: Cooper's Adventures

Keep Reading...

Some Thoughts on SEO

This is something that will likely be a focal point of my future SEO strategies. Though a bit more work, it looks as though it could really pay off. Take a look at some of the docs linked above. The basic idea is to help search engines gain a better understanding of your websites content. Check out the code sample:

<div itemscope itemtype ="">
  <h1 itemprop="name">Avatar</h1>
  <div itemprop="director" itemscope itemtype="http://schema ...

Keep Reading...

Sending SMTP Mail in Django

I have been using Django's email backend for quite some time.


I use a third party SMTP server and it has always worked quite well. However, after a recent update to Django 1.9.5 my email backend broke. The fix was easy though. I needed to specificly declare in the email backend that I was connecting to my SMTP server via SSL. Here is my by email backend setup:

EMAIL_BACKEND = 'django.core.mail ...

Keep Reading...