Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Django Google custom search engine app.

branch: develop

Merge pull request #4 from Anurag-Ans/develop

ImportError at /  No module named defaults
latest commit 77442a651c
Hedley Roos hedleyroos authored March 18, 2014
Octocat-spinner-32 googlesearch Update urls.py March 18, 2014
Octocat-spinner-32 .gitignore first commit May 21, 2010
Octocat-spinner-32 AUTHORS.rst Prep for release May 06, 2012
Octocat-spinner-32 CHANGELOG.rst Prep for release January 14, 2013
Octocat-spinner-32 LICENSE copy correction June 17, 2010
Octocat-spinner-32 MANIFEST.in prepare v0.0.5 release August 11, 2011
Octocat-spinner-32 README.rst Refer to correct template tag January 14, 2013
Octocat-spinner-32 setup.py Prep for release January 14, 2013
Octocat-spinner-32 test_settings.py added testrunner August 30, 2011
README.rst

Django Google Search

Django Google custom search engine app.

Provides a simple tag rendering a Google Custom Search Engine input field and a view displaying search results. The product is an implementation of http://www.google.com/cse/docs/cref.html. The custom search engine definition is stored on your site, not by Google. This allows you to define a search engine in version controlled code.

Contents

Installation

  1. Install or add django-googlesearch to your Python path.

  2. Add googlesearch to your INSTALLED_APPS setting.

  3. Add googlesearch url include to your project's urls.py file:

    (r'^search/', include('googlesearch.urls')),
    
  4. Optionally add "django.core.context_processors.request", to your TEMPLATE_CONTEXT_PROCESSORS setting, i.e.:

    TEMPLATE_CONTEXT_PROCESSORS = (
        "django.core.context_processors.request",
        ...other processors...
    )
    

    We need a request object when rendering the search input field and results to be able to display the search query value. This is optional and is not required for operation but is highly recommended.

Usage

Once installed you can add a Google search box to your templates by using the googlesearch_form template tag, i.e.:

{% load googlesearch_inclusion_tags %}

...some html...

{% googlesearch_form %}

...some more html...

By default search results are displayed through the view with URL named googlesearch-results, as defined in googlesearch.urls. You can create your own URL named googlesearch-results and include the googlesearch_results template tag in its template to display results, i.e.:

{% load googlesearch_inclusion_tags %}

...some html...

{% googlesearch_results %}

...some more html...
Something went wrong with that request. Please try again.