Can I compare a template variable to an integer in Django/App Engine templates?

You are most probably using Django 0.96:

The App Engine Python environment includes three versions of Django: 0.96, 1.0.2, and 1.1. Django 0.96 is included with the App Engine SDK, and is the version that gets imported by default when an app imports the django package.

Source: http://code.google.com/appengine/docs/python/tools/libraries.html#Django

As xyld has said, you must use the ifequal templatetag, because boolean operators were included only in version 1.2, that is currently in beta.

The documentation for version 0.96 can be found here or you can also use version 1.1:

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from google.appengine.dist import use_library
use_library('django', '1.1')

Of course, you can always download the entire Django project, and include it in your application's top level directory. Some tips on how to do that can be found in this article.

EDIT: Since the ifequal is not suited for integers, you can pass additional variables to your template.

class MyHandler(webapp.RequestHandler):
    def get(self):
        foo_list = db.GqlQuery(...)
        ...
        template_values['foos'] = foo_list
        template_values['foo_count'] = len(foo_list)
        template_values['one_foo'] = len(foo_list) == 1
        handler.response.out.write(template.render(...))

and in the template:

{% if one_foo %}
    You have one foo.
{% endif %}

or:

{% if foo_list %}
    You have {{ foo_count }} foo{{foo_count|pluralize}}.
{% else %}
    You have no foos
{% endif %}

right:

{% if foo_list == 1 %}

wrong:

{% if foo_list== 1 %}