Entries Tagged ‘How To’:

How to Add Locations to Python Path for Reusable Django Apps

In my
previous post I talk about reusable apps, but I don’t really explain it that much. If you have an app that might be useful in another project, it’s best to not refer to the project name in the application so you don’t have to search and remove it when adding to another project. [...]

Getting Basecamp API Working with Python

I found
one library that was linked everywhere, but it wasn’t working for me. I was always getting 400 Bad Request when using it. Chris Conover was able to get the following code working.

import urllib2
 
protocol = ‘https://’
url = ‘example.com’
command = ‘/projects.xml’
headers = {’Accept’ : ‘application/xml’,
‘Content-type’ : ‘applications/xml’}
username = ‘x’
password = ‘y’
 
# Setup password stuff
passman [...]

How to Write Django Template Tags

Template tags can be useful for making your applications more reusable by other projects. For this example I will be adding to the
books project that I started in a previous post. Also, I’ve bundled the
example files into a google code project.
Start off by creating a folder called templatetags in your app directory and [...]

Django RequestContext Example

Browsing other peoples’ code is a great way to learn new things about a language or framework. I never made it to the Django docs about Contexts, but the
Pinax developers apparently did and I got a chance to learn this from them. This is a few sections of their code and how they use [...]

Quick Thumbnails in Django

I normally like to write code myself instead of installing some large script just to do one task for me. There were a few scripts out there that could create thumbnails, but I wanted something simple and wouldn’t use most of those features. Plus, I wanted to know how to use the Python Image Library [...]